Point Cloud Library (PCL)  1.10.0-dev
opennurbs_linetype.h
1 /* $NoKeywords: $ */
2 /*
3 //
4 // Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
5 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
6 // McNeel & Associates.
7 //
8 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
9 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
10 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
11 //
12 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
13 //
14 ////////////////////////////////////////////////////////////////
15 */
16 
17 #if !defined(OPENNURBS_LINETYPE_INC_)
18 #define OPENNURBS_LINETYPE_INC_
19 
20 
21 // Description:
22 // Determine if a line width is deemed to be a "hairline width" in Rhino
23 // Any width that is >0 and < 0.001 mm is a hairline width for printing
24 // Parameters:
25 // width_mm: [in] the width to examine in millimeters
26 // Returns:
27 // true if this is a hairline width
28 ON_DECL bool ON_IsHairlinePrintWidth( double width_mm );
29 
30 // Description:
31 // Return a width in millimeters that is a valid hairline width in rhino
32 ON_DECL double ON_HairlinePrintWidth();
33 
34 
35 
36 
37 //////////////////////////////////////////////////////////////////////
38 // class ON_Linetype
39 
40 class ON_CLASS ON_Linetype : public ON_Object
41 {
42  ON_OBJECT_DECLARE(ON_Linetype);
43 
44 public:
45 
46  /*
47  Description:
48  Sets index = -1.
49  */
50  ON_Linetype();
51 
52  ~ON_Linetype();
53 
54 
55  /*
56  Description:
57  Sets index = -1 and emptys name and segment list.
58  */
59  void Default();
60 
61  /*
62  Description:
63  Tests that name is set and there is at least one non-zero length segment
64  */
65  ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
66 
67  void Dump( ON_TextLog& ) const; // for debugging
68 
69  /*
70  Description:
71  Write to file
72  */
73  ON_BOOL32 Write(
74  ON_BinaryArchive& // serialize definition to binary archive
75  ) const;
76 
77  /*
78  Description:
79  Read from file
80  */
81  ON_BOOL32 Read(
82  ON_BinaryArchive& // restore definition from binary archive
83  );
84 
85  // virtual
86  ON_UUID ModelObjectId() const;
87 
88 
89  //////////////////////////////////////////////////////////////////////
90  //
91  // Interface
92 
93  /*
94  Unique name for each linetype
95  */
96  bool SetLinetypeName( const char*);
97  bool SetLinetypeName( const wchar_t*);
98  const wchar_t* LinetypeName() const;
99 
100  /*
101  Index of each linetype
102  This index is used by geometry objects to
103  reference a specific linetype
104  */
105  bool SetLinetypeIndex( int);
106  int LinetypeIndex() const;
107 
108  /*
109  Description:
110  Returns the total length of one repeat of the pattern
111  */
112  double PatternLength() const;
113 
114 
115  /*
116  Description:
117  Returns the number of segments in the pattern
118  */
119  int SegmentCount() const;
120 
121  /*
122  Description:
123  Adds a segment to the pattern
124  Returns:
125  Index of the added segment.
126  */
127  int AppendSegment( const ON_LinetypeSegment& segment);
128 
129  /*
130  Description:
131  Removes a segment in the linetype.
132  Parameters:
133  index - [in]
134  Zero based index of the segment to remove.
135  Returns:
136  True if the segment index was removed.
137  */
138  bool RemoveSegment( int index );
139 
140  /*
141  Description:
142  Sets the segment at index to match segment
143  */
144  bool SetSegment( int index, const ON_LinetypeSegment& segment);
145 
146  /*
147  Description:
148  Sets the length and type of the segment at index
149  */
150  bool SetSegment( int index, double length, ON_LinetypeSegment::eSegType type);
151 
152  /*
153  Description:
154  Returns a copy of the segment at index
155  */
156  ON_LinetypeSegment Segment( int index) const;
157 
158  /*
159  Description:
160  Expert user function to get access to the segment array
161  for rapid calculations.
162  */
164  const ON_SimpleArray<ON_LinetypeSegment>& Segments() const;
165 
166 public:
168  ON_UUID m_linetype_id; // Set by Rhino - unique id of this linetype
170 
171 private:
173 };
174 
175 #endif
176 
virtual ON_BOOL32 IsValid(ON_TextLog *text_log=NULL) const =0
ON_wString m_linetype_name
virtual ON_BOOL32 Write(ON_BinaryArchive &binary_archive) const
virtual ON_BOOL32 Read(ON_BinaryArchive &binary_archive)
virtual void Dump(ON_TextLog &) const
virtual ON_UUID ModelObjectId() const