opennurbs_linetype.h
Go to the documentation of this file.
00001 /* $NoKeywords: $ */
00002 /*
00003 //
00004 // Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
00005 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
00006 // McNeel & Associates.
00007 //
00008 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
00009 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
00010 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
00011 //                              
00012 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
00013 //
00015 */
00016 
00017 #if !defined(OPENNURBS_LINETYPE_INC_)
00018 #define OPENNURBS_LINETYPE_INC_
00019 
00020 
00021 // Description:
00022 //   Determine if a line width is deemed to be a "hairline width" in Rhino
00023 //   Any width that is >0 and < 0.001 mm is a hairline width for printing
00024 // Parameters:
00025 //   width_mm: [in] the width to examine in millimeters
00026 // Returns:
00027 //   true if this is a hairline width
00028 ON_DECL bool ON_IsHairlinePrintWidth( double width_mm );
00029 
00030 // Description:
00031 //   Return a width in millimeters that is a valid hairline width in rhino
00032 ON_DECL double ON_HairlinePrintWidth();
00033 
00034 
00035 
00036 
00038 // class ON_Linetype
00039 
00040 class ON_CLASS ON_Linetype : public ON_Object
00041 {
00042   ON_OBJECT_DECLARE(ON_Linetype);
00043 
00044 public:
00045 
00046   /*
00047   Description:
00048     Sets index = -1.
00049   */
00050   ON_Linetype();
00051 
00052   ~ON_Linetype();
00053 
00054 
00055   /*
00056   Description:
00057     Sets index = -1 and emptys name and segment list.
00058   */
00059   void Default();
00060 
00061   /*
00062     Description:
00063       Tests that name is set and there is at least one non-zero length segment
00064   */
00065   ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const;
00066 
00067   void Dump( ON_TextLog& ) const; // for debugging
00068 
00069   /*
00070     Description:
00071       Write to file
00072   */
00073   ON_BOOL32 Write(
00074          ON_BinaryArchive&  // serialize definition to binary archive
00075        ) const;
00076 
00077   /*
00078     Description:
00079       Read from file
00080   */
00081   ON_BOOL32 Read(
00082          ON_BinaryArchive&  // restore definition from binary archive
00083        );
00084 
00085   // virtual
00086   ON_UUID ModelObjectId() const;
00087 
00088 
00090   //
00091   // Interface
00092 
00093   /*
00094     Unique name for each linetype
00095   */
00096   bool SetLinetypeName( const char*);
00097   bool SetLinetypeName( const wchar_t*);
00098         const wchar_t* LinetypeName() const;
00099 
00100   /*
00101     Index of each linetype
00102     This index is used by geometry objects to 
00103     reference a specific linetype
00104   */
00105   bool SetLinetypeIndex( int);
00106   int LinetypeIndex() const;
00107 
00108   /*
00109     Description:
00110       Returns the total length of one repeat of the pattern
00111   */
00112   double PatternLength() const;
00113 
00114 
00115   /*
00116     Description:
00117       Returns the number of segments in the pattern
00118   */
00119   int SegmentCount() const;
00120 
00121   /*
00122   Description:
00123     Adds a segment to the pattern
00124   Returns:
00125     Index of the added segment.
00126   */
00127   int AppendSegment( const ON_LinetypeSegment& segment);
00128 
00129   /*
00130   Description:
00131     Removes a segment in the linetype.
00132   Parameters:
00133     index - [in]
00134       Zero based index of the segment to remove.
00135   Returns:
00136     True if the segment index was removed.
00137   */
00138   bool RemoveSegment( int index );
00139 
00140   /*
00141     Description:
00142       Sets the segment at index to match segment
00143   */
00144   bool SetSegment( int index, const ON_LinetypeSegment& segment);
00145 
00146   /*
00147     Description:
00148       Sets the length and type of the segment at index
00149   */
00150   bool SetSegment( int index, double length, ON_LinetypeSegment::eSegType type);
00151 
00152   /*
00153     Description:
00154       Returns a copy of the segment at index
00155   */
00156   ON_LinetypeSegment Segment( int index) const;
00157 
00158   /*
00159     Description:
00160       Expert user function to get access to the segment array
00161       for rapid calculations.
00162   */
00163   ON_SimpleArray<ON_LinetypeSegment>& Segments();
00164   const ON_SimpleArray<ON_LinetypeSegment>& Segments() const;
00165 
00166 public:
00167   int m_linetype_index;
00168   ON_UUID m_linetype_id;    // Set by Rhino - unique id of this linetype
00169   ON_wString m_linetype_name;
00170 
00171 private:
00172   ON_SimpleArray<ON_LinetypeSegment> m_segments;
00173 };
00174 
00175 #endif
00176 


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:27:01