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_LAYER_INC_) 00018 #define OPENNURBS_LAYER_INC_ 00019 00020 class ON_CLASS ON_Layer : public ON_Object 00021 { 00022 ON_OBJECT_DECLARE(ON_Layer); 00023 00024 public: 00025 00026 ON_Layer(); 00027 ~ON_Layer(); 00028 // C++ default copy construction and operator= work fine. 00029 // Do not add custom versions. 00030 00032 // 00033 // ON_Object overrides 00034 00035 /* 00036 Description: 00037 Tests an object to see if its data members are correctly 00038 initialized. 00039 Parameters: 00040 text_log - [in] if the object is not valid and text_log 00041 is not NULL, then a brief englis description of the 00042 reason the object is not valid is appened to the log. 00043 The information appended to text_log is suitable for 00044 low-level debugging purposes by programmers and is 00045 not intended to be useful as a high level user 00046 interface tool. 00047 Returns: 00048 @untitled table 00049 true object is valid 00050 false object is invalid, uninitialized, etc. 00051 Remarks: 00052 Overrides virtual ON_Object::IsValid 00053 */ 00054 ON_BOOL32 IsValid( ON_TextLog* text_log = NULL ) const; 00055 00056 void Dump( ON_TextLog& ) const; // for debugging 00057 00058 ON_BOOL32 Write( 00059 ON_BinaryArchive& // serialize definition to binary archive 00060 ) const; 00061 00062 ON_BOOL32 Read( 00063 ON_BinaryArchive& // restore definition from binary archive 00064 ); 00065 00066 ON::object_type ObjectType() const; 00067 00068 ON_UUID ModelObjectId() const; 00069 00071 // 00072 // Interface 00073 00074 void Default(); 00075 00076 bool SetLayerName( const char* ); 00077 bool SetLayerName( const wchar_t* ); 00078 const ON_wString& LayerName() const; 00079 00080 /* 00081 Description: 00082 The string returned by ON_Layer::LayerNameReferenceDelimiter() 00083 is used to separate the name of a reference file from the name of 00084 the layer in the file. 00085 Example: 00086 If a layer named "electrical" is in a file named "house plan.3dm" 00087 and "house plan.3dm" is a reference file in a Rhino worksession, 00088 then Rhino's user interface will use the string 00089 "house plan : electrical" to identify the layer. 00090 Returns: 00091 " : " (null terminated string space,colon,space) 00092 Remarks: 00093 Rhino does not save the names of reference files in 3dm archives. 00094 Reference file names are used as runtime decorations. 00095 */ 00096 static const wchar_t* LayerNameReferenceDelimiter(); 00097 00098 /* 00099 Description: 00100 The string "::" (colon,colon) returned by LayerNamePathDelimiter() 00101 is used to separate parent and child layer names. 00102 Example: 00103 If a model of a building has "level 1" and "level 2" as top level 00104 layers, an architect might choose to have a "fixtures" sublayer 00105 on each level. The complete layer names would be 00106 "level 1::fixtures" and "level 2::fixtures". 00107 Returns: 00108 "::" (null terminated string colon,colon) 00109 */ 00110 static const wchar_t* LayerNamePathDelimiter(); 00111 00112 /* 00113 Description: 00114 Get a layer name's "leaf" level name. 00115 Example: 00116 If a layer name is "refernce file : alpha::beta::gamma", 00117 then ON_Layer::GetLeafName() returns "gamma" 00118 Returns: 00119 True if the layer has a valid non-empty leaf name. 00120 */ 00121 static bool GetLeafName( const wchar_t* layer_name, ON_wString& leaf_name); 00122 00123 /* 00124 Description: 00125 Get the layer's "parent" path name. 00126 Example: 00127 If a layer name is "refenence file : alpha::beta::gamma", then 00128 ON_Layer::GetParentPathName() returns "alpha::beta" 00129 Returns: 00130 True if the layer has a valid non-empty parent path name. 00131 */ 00132 static bool GetParentName( const wchar_t* layer_name, ON_wString& parent_path_name ); 00133 00134 /* 00135 Description: 00136 Remove any "reference : " prefix from a layer's name. 00137 Parameters: 00138 layer_name - [in] 00139 layer_path_name - [out] 00140 layer_name with any reference prefix removed. 00141 Example: 00142 If a layer name is "refenence file : alpha::beta::gamma", then 00143 ON_Layer::RemoveReferenceName() returns "alpha::beta::gamma" 00144 Returns: 00145 True if layer_path_name is non-empty. If no reference prefix was present, 00146 then the returned layer_path_name is identical to the input layer_name. 00147 */ 00148 static bool RemoveReferenceName( const wchar_t* layer_name, ON_wString& layer_path_name ); 00149 00150 /* 00151 Description: 00152 Get the layer's reference name. 00153 Example: 00154 If a layer name is "refenence file : alpha::beta::gamma", then 00155 ON_Layer::GetReferenceFileName() returns "refenence file" 00156 Returns: 00157 True if the layer has a valid non-empty reference file name. 00158 */ 00159 static bool GetReferenceName( const wchar_t* layer_name, ON_wString& reference_name ); 00160 00161 // The PER_VIEWPORT_SETTINGS enum defines 00162 // the bits used to set masks in functions used 00163 // to specify and query per viewport layer settings. 00164 enum PER_VIEWPORT_SETTINGS 00165 { 00166 per_viewport_none = 0, 00167 00168 per_viewport_id = 1, 00169 per_viewport_color = 2, 00170 per_viewport_plot_color = 4, 00171 per_viewport_plot_weight = 8, 00172 per_viewport_visible = 16, 00173 per_viewport_persistent_visibility = 32, 00174 00175 per_viewport_all_settings = 0xFFFFFFFF 00176 // (Developers: these values are used in file IO and must not be changed.) 00177 }; 00178 00179 /* 00180 Parameters: 00181 viewport_id - [in] 00182 If viewport_id is not nil, then checks for per viewport 00183 settings for that specific viewport. 00184 If viewport_id is nil, then checks for per viewport settings 00185 in any viewport. 00186 settings_mask - [in] 00187 settings_mask is a bitfield that specifies which settings 00188 to check for. The bits are defined in the 00189 ON_Layer::PER_VIEWPORT_PROPERTIES enum. If you want to 00190 determine if the layer has any per viewport settings, 00191 then pass 0xFFFFFFFF. 00192 Returns: 00193 True if the layer has per viewport override for the specified 00194 settings. 00195 */ 00196 bool HasPerViewportSettings( 00197 ON_UUID viewport_id, 00198 unsigned int settings_mask 00199 ) const; 00200 00201 /* 00202 Parameters: 00203 viewport_id - [in] 00204 If viewport_id is not nil, then checks for setting for 00205 that specific viewport. 00206 If viewport_id is nil, then checks for any viewport settings. 00207 Returns: 00208 True if the layer has per viewport settings. 00209 */ 00210 bool HasPerViewportSettings( 00211 const ON_UUID& viewport_id 00212 ) const; 00213 00214 00215 /* 00216 Description: 00217 Copies all per viewport settings for the source_viewport_id 00218 Parameters: 00219 source_viewport_id - [in] 00220 viewport id to copy all per viewport settings from 00221 destination_viewport_id - [in] 00222 viewport od to copy all per viewport settings to 00223 Returns: 00224 True if the settings could be copied, False if no per-viewport 00225 settings exist for the source viewport id 00226 */ 00227 bool CopyPerViewportSettings( 00228 ON_UUID source_viewport_id, 00229 ON_UUID destination_viewport_id 00230 ); 00231 00232 00233 /* 00234 Description: 00235 Copies specified per viewport settings from a source layer to this 00236 layer. 00237 Parameters: 00238 source_layer - [in] 00239 layer to copy settings from 00240 viewport_id - [in] 00241 viewport id to copy all per viewport settings from. 00242 If viewport_id is nil, then the per viewport settings 00243 for all viewports will be copied. 00244 settings_mask - [in] 00245 bits indicate which settings to copy 00246 Use the ON_Layer PER_VIEWPORT_SETTINGS enum to 00247 set the bits. 00248 Returns: 00249 True if the settings were copied, False if no per-viewport 00250 settings exist for the specified viewport_id. 00251 */ 00252 bool CopyPerViewportSettings( 00253 const ON_Layer& source_layer, 00254 ON_UUID viewport_id, 00255 unsigned int settings_mask 00256 ); 00257 00258 /* 00259 Description: 00260 Delete per viewport layer settings. 00261 Parameters: 00262 viewport_id - [in] 00263 If viewport_id is not nil, then the settings for that 00264 viewport are deleted. If viewport_id is nil, then all 00265 per viewport settings are deleted. 00266 */ 00267 void DeletePerViewportSettings( 00268 const ON_UUID& viewport_id 00269 ) const; 00270 00271 /* 00272 Description: 00273 Cull unused per viewport layer settings. 00274 Parameters: 00275 viewport_id_count - [in] 00276 viewport_id_list - [in] 00277 Settings for any viewports NOT in the viewport_id_list[] 00278 are culled. 00279 */ 00280 void CullPerViewportSettings( 00281 int viewport_id_count, 00282 const ON_UUID* viewport_id_list 00283 ); 00284 00285 /* 00286 Description: 00287 The PerViewportSettingsCRC() can be used to determine 00288 when layers have different per viewport settings. 00289 */ 00290 ON__UINT32 PerViewportSettingsCRC() const; 00291 00292 /* 00293 Description: 00294 Set the color used by objects on this layer that do 00295 not have a per object color set 00296 Parameters: 00297 layer_color - [in] 00298 Passing ON_UNSET_COLOR will clear the settings. 00299 viewport_id - [in] 00300 If viewport_id is not nil, then the setting applies only 00301 to the viewport with the specified id. 00302 */ 00303 void SetColor( ON_Color layer_color ); // layer display color 00304 00305 /* 00306 Description: 00307 Set the color used by objects on this layer that do 00308 not have a per object color set 00309 Parameters: 00310 viewport_id - [in] 00311 If viewport_id is not nil, then the setting applies only 00312 to the viewport with the specified id. 00313 layer_color - [in] 00314 Passing ON_UNSET_COLOR will clear the settings. 00315 */ 00316 void SetPerViewportColor( ON_UUID viewport_id, ON_Color layer_color ); 00317 00318 /* use ON_Layer::SetPerViewportColor */ 00319 ON_DEPRECATED void SetColor( ON_Color, const ON_UUID& ); 00320 00321 /* 00322 Parameters: 00323 viewport_id - [in] 00324 If viewport_id is not nil, then the setting to use 00325 for a specific viewport is returned. 00326 Returns: 00327 The color used by objects on this layer that do 00328 not have a per object color set. 00329 */ 00330 ON_Color Color() const; 00331 00332 /* 00333 Parameters: 00334 viewport_id - [in] 00335 If viewport_id is not nil, then the setting to use 00336 for a specific viewport is returned. 00337 Returns: 00338 The color used by objects in the specified viewport and 00339 on this layer that do not have a per object color set. 00340 */ 00341 ON_Color PerViewportColor( ON_UUID viewport_id ) const; 00342 00343 /* use ON_Layer::PerViewportColor */ 00344 ON_DEPRECATED ON_Color Color( const ON_UUID& ) const; 00345 00346 /* 00347 Description: 00348 Remove any per viewport layer color setting so the 00349 layer's overall setting will be used for all viewports. 00350 Parameters: 00351 viewport_id - [in] 00352 If viewport_id is not nil, then the setting for this 00353 viewport will be deleted. If viewport_id is nil, 00354 the all per viewport layer color settings will be removed. 00355 */ 00356 void DeletePerViewportColor( const ON_UUID& viewport_id ); 00357 00358 /* 00359 Description: 00360 Set the plotting color used by objects on this layer that do 00361 not have a per object plotting color set 00362 Parameters: 00363 plot_color - [in] 00364 Passing ON_UNSET_COLOR will clear the settings. 00365 viewport_id - [in] 00366 If viewport_id is not nil, then the setting applies only 00367 to the viewport with the specified id. 00368 */ 00369 void SetPlotColor( ON_Color plot_color ); // plotting color 00370 00371 void SetPerViewportPlotColor( ON_UUID viewport_id, ON_Color plot_color ); 00372 00373 /* use ON_Layer::SetPerViewportPlotColor */ 00374 ON_DEPRECATED void SetPlotColor( ON_Color, const ON_UUID& ); 00375 00376 /* 00377 Returns: 00378 The plotting color used by objects on this layer that do 00379 not have a per object color set. 00380 */ 00381 ON_Color PlotColor() const; 00382 00383 /* 00384 Parameters: 00385 viewport_id - [in] 00386 If viewport_id is not nil, then the setting to use 00387 for a specific viewport is returned. 00388 Returns: 00389 The plotting color used by objects on this layer that do 00390 not have a per object color set. 00391 */ 00392 ON_Color PerViewportPlotColor( ON_UUID viewport_id ) const; 00393 00394 /* use ON_Layer::PerViewportPlotColor */ 00395 ON_DEPRECATED ON_Color PlotColor( const ON_UUID& ) const; 00396 00397 /* 00398 Description: 00399 Remove any per viewport plot color setting so the 00400 layer's overall setting will be used for all viewports. 00401 Parameters: 00402 viewport_id - [in] 00403 If viewport_id is not nil, then the setting for this 00404 viewport will be deleted. If viewport_id is nil, 00405 the all per viewport plot color settings will be removed. 00406 */ 00407 void DeletePerViewportPlotColor( const ON_UUID& viewport_id ); 00408 00409 /* 00410 Description: 00411 Set the index of the linetype used by objects on this layer that do 00412 not have a per object lintypes 00413 Parameters: 00414 linetype_index - [in] 00415 Passing -1 will clear the setting. 00416 */ 00417 bool SetLinetypeIndex( int linetype_index ); 00418 00419 /* 00420 Returns: 00421 The index of the linetype used by objects on this layer that do 00422 not have a per object linetype set. 00423 */ 00424 int LinetypeIndex() const; 00425 00426 /* 00427 Returns: 00428 Returns true if objects on layer are visible. 00429 Remarks: 00430 Does not inspect per viewport settings. 00431 See Also: 00432 ON_Layer::SetVisible 00433 */ 00434 bool IsVisible() const; 00435 00436 /* 00437 Description: 00438 Controls layer visibility 00439 Parameters: 00440 bVisible - [in] true to make layer visible, 00441 false to make layer invisible 00442 viewport_id - [in] 00443 If viewport_id is not nil, then the setting applies only 00444 to the viewport with the specified id. 00445 See Also: 00446 ON_Layer::IsVisible 00447 */ 00448 void SetVisible( bool bVisible ); 00449 00450 /* 00451 Description: 00452 The persistent visbility setting is used for layers whose 00453 visibilty can be changed by a "parent" object. A common case 00454 is when a layer is a child layer (ON_Layer.m_parent_id is 00455 not nil). In this case, when a parent layer is turned off, 00456 then child layers are also turned off. The persistent 00457 visibility setting determines what happens when the parent 00458 is turned on again. 00459 Returns: 00460 true: 00461 If this layer's visibility is controlled by a parent object 00462 and the parent is turned on (after being off), then this 00463 layer will also be turned on. 00464 false: 00465 If this layer's visibility is controlled by a parent object 00466 and the parent layer is turned on (after being off), then 00467 this layer will continue to be off. 00468 Remarks: 00469 When the persistent visbility is not explicitly set, this 00470 function returns the current value of IsVisible(). 00471 See Also: 00472 ON_Layer::SetPersistentVisibility 00473 ON_Layer::UnsetPersistentVisibility 00474 */ 00475 bool PersistentVisibility() const; 00476 00477 /* 00478 Description: 00479 Set the persistent visibility setting for this layer. 00480 Parameters: 00481 bPersistentVisibility - [in] 00482 persistent visibility setting for this layer. 00483 Remarks: 00484 See ON_Layer::PersistentVisibility for a detailed description 00485 of persistent visibility. 00486 See Also: 00487 ON_Layer::PersistentVisibility 00488 ON_Layer::UnsetPersistentVisibility 00489 */ 00490 void SetPersistentVisibility( bool bPersistentVisibility ); 00491 00492 /* 00493 Description: 00494 Remove any explicit persistent visibility setting from this 00495 layer. When persistent visibility is not explictly set, 00496 the value of ON_Layer::IsVisible() is used. 00497 Remarks: 00498 See ON_Layer::PersistentVisibility for a detailed description 00499 of persistent visibility. 00500 See Also: 00501 ON_Layer::PersistentVisibility 00502 ON_Layer::SetPersistentVisibility 00503 */ 00504 void UnsetPersistentVisibility(); 00505 00506 /* 00507 Parameters: 00508 viewport_id - [in] 00509 If viewport_id is not nil, then the visibility setting 00510 for that viewport is returned. If viewport_id 00511 is nil, then true is returned if the layer is visible 00512 in some viewport. 00513 Returns: 00514 Returns true if objects on layer are visible. 00515 */ 00516 bool PerViewportIsVisible( ON_UUID viewport_id ) const; 00517 00518 /* use ON_Layer::PerViewportIsVisible */ 00519 ON_DEPRECATED bool IsVisible( const ON_UUID& ) const; 00520 00521 /* 00522 Description: 00523 Controls layer visibility in specific viewports. 00524 Parameters: 00525 viewport_id - [in] 00526 If viewport_id is not nil, then the setting applies only 00527 to the viewport with the specified id. If viewport_id 00528 is nil, then the setting applies to all viewports with 00529 per viewport layer settings. 00530 bVisible - [in] true to make layer visible, 00531 false to make layer invisible 00532 See Also: 00533 ON_Layer::IsVisibleInViewport() 00534 */ 00535 void SetPerViewportVisible( ON_UUID viewport_id, bool bVisible ); 00536 00537 /* use ON_Layer::SetPerViewportVisible */ 00538 ON_DEPRECATED void SetVisible( bool, const ON_UUID& ); 00539 00540 /* 00541 Parameters: 00542 viewport_id - [in] 00543 id of a viewport. If viewport_id is nil, then 00544 ON_Layer::PersistentVisibility() is returned. 00545 Returns: 00546 true: 00547 If this layer's visibility in the specified viewport is 00548 controlled by a parent object and the parent is turned on 00549 (after being off), then this layer will also be turned on 00550 in the specified viewport. 00551 false: 00552 If this layer's visibility in the specified viewport is 00553 controlled by a parent object and the parent layer is 00554 turned on (after being off), then this layer will continue 00555 to be off in the specified viewport. 00556 Remarks: 00557 See ON_Layer::SetPersistentVisibility 00558 for a description of persistent visibility. 00559 See Also: 00560 ON_Layer::SetPerViewportPersistentVisibility 00561 */ 00562 bool PerViewportPersistentVisibility( ON_UUID viewport_id ) const; 00563 00564 /* 00565 Description: 00566 This function allows per viewport setting the 00567 child visibility property. 00568 Parameters 00569 viewport_id - [in] 00570 bPersistentVisibility - [in] 00571 Remarks: 00572 See ON_Layer::SetPersistentVisibility 00573 for a description of the child visibility property. 00574 See Also: 00575 ON_Layer::SetPersistentVisibility 00576 */ 00577 void SetPerViewportPersistentVisibility( ON_UUID viewport_id, bool bPersistentVisibility ); 00578 00579 void UnsetPerViewportPersistentVisibility( ON_UUID viewport_id ); 00580 00581 /* 00582 Description: 00583 Remove any per viewport visibility setting so the 00584 layer's overall setting will be used for all viewports. 00585 Parameters: 00586 viewport_id - [in] 00587 If viewport_id is not nil, then the setting for this 00588 viewport will be deleted. If viewport_id is nil, 00589 the all per viewport visibility settings will be removed. 00590 */ 00591 void DeletePerViewportVisible( const ON_UUID& viewport_id ); 00592 00593 /* 00594 Description: 00595 Get a list of the viewport ids of viewports that 00596 that have per viewport visibility settings that 00597 override the default layer visibility setting 00598 ON_Layer::m_bVisible. 00599 Parameters: 00600 viewport_id_list - [out] 00601 List of viewport id's that have a per viewport visibility 00602 setting. If the returned list is empty, then there 00603 are no per viewport visibility settings. 00604 Returns: 00605 Number of ids added to the list. 00606 */ 00607 void GetPerViewportVisibilityViewportIds( 00608 ON_SimpleArray<ON_UUID>& viewport_id_list 00609 ) const; 00610 00611 /* 00612 Returns: 00613 Returns true if objects on layer are locked. 00614 See Also: 00615 ON_Layer::SetLocked 00616 */ 00617 bool IsLocked() const; 00618 00619 /* 00620 Description: 00621 Controls layer locked 00622 Parameters: 00623 bLocked - [in] True to lock layer 00624 False to unlock layer 00625 See Also: 00626 ON_Layer::IsLocked 00627 */ 00628 void SetLocked( bool bLocked ); 00629 00630 /* 00631 Description: 00632 The persistent locking setting is used for layers that can 00633 be locked by a "parent" object. A common case is when a layer 00634 is a child layer (ON_Layer.m_parent_id is not nil). In this 00635 case, when a parent layer is locked, then child layers are 00636 also locked. The persistent locking setting determines what 00637 happens when the parent is unlocked again. 00638 Returns: 00639 true: 00640 If this layer's locking is controlled by a parent object 00641 and the parent is unlocked (after being locked), then this 00642 layer will also be unlocked. 00643 false: 00644 If this layer's locking is controlled by a parent object 00645 and the parent layer is unlocked (after being locked), then 00646 this layer will continue to be locked. 00647 Remarks: 00648 When the persistent locking is not explicitly set, this 00649 function returns the current value of IsLocked(). 00650 See Also: 00651 ON_Layer::SetPersistentLocking 00652 ON_Layer::UnsetPersistentLocking 00653 */ 00654 bool PersistentLocking() const; 00655 00656 /* 00657 Description: 00658 Set the persistent locking setting for this layer. 00659 Parameters: 00660 bPersistentLocking - [in] 00661 persistent locking for this layer. 00662 Remarks: 00663 See ON_Layer::PersistentLocking for a detailed description of 00664 persistent locking. 00665 See Also: 00666 ON_Layer::PersistentLocking 00667 ON_Layer::UnsetPersistentLocking 00668 */ 00669 void SetPersistentLocking(bool bPersistentLocking); 00670 00671 /* 00672 Description: 00673 Remove any explicity persistent locking settings from this 00674 layer. 00675 Remarks: 00676 See ON_Layer::PersistentLocking for a detailed description of 00677 persistent locking. 00678 See Also: 00679 ON_Layer::PersistentLocking 00680 ON_Layer::SetPersistentLocking 00681 */ 00682 void UnsetPersistentLocking(); 00683 00684 /* 00685 Returns: 00686 Value of (IsVisible() && !IsLocked()). 00687 */ 00688 bool IsVisibleAndNotLocked() const; 00689 00690 /* 00691 Returns: 00692 Value of (IsVisible() && IsLocked()). 00693 */ 00694 bool IsVisibleAndLocked() const; 00695 00697 // Index of render material for objects on this layer that have 00698 // MaterialSource() == ON::material_from_layer. 00699 // A material index of -1 indicates no material has been assigned 00700 // and the material created by the default ON_Material constructor 00701 // should be used. 00702 bool SetRenderMaterialIndex( int ); // index of layer's rendering material 00703 int RenderMaterialIndex() const; 00704 00705 bool SetLayerIndex( int ); // index of this layer; 00706 int LayerIndex() const; 00707 00708 bool SetIgesLevel( int ); // IGES level for this layer 00709 int IgesLevel() const; 00710 00711 /* 00712 Description: 00713 Get the weight (thickness) of the plotting pen. 00714 Returns: 00715 Thickness of the plotting pen in millimeters. 00716 A thickness of 0.0 indicates the "default" pen weight should be used. 00717 A thickness of -1.0 indicates the layer should not be printed. 00718 */ 00719 double PlotWeight() const; 00720 00721 double PerViewportPlotWeight( ON_UUID viewport_id ) const; 00722 00723 /* use ON_Layer::PerViewportPlotWeight */ 00724 ON_DEPRECATED double PlotWeight( const ON_UUID& ) const; 00725 00726 /* 00727 Description: 00728 Set the weight of the plotting pen. 00729 Parameters: 00730 plot_weight_mm - [in] Set the thickness of the plotting pen in millimeters. 00731 0.0 means use the default pen width which is a Rhino app setting. 00732 -1.0 means layer does not print (still displays on the screen) 00733 */ 00734 void SetPlotWeight(double plot_weight_mm); 00735 00736 /* 00737 Description: 00738 Set the weight of the plotting pen. 00739 Parameters: 00740 plot_weight_mm - [in] Set the thickness of the plotting pen in millimeters. 00741 0.0 means use the default pen width which is a Rhino app setting. 00742 -1.0 means layer does not print (still displays on the screen) 00743 */ 00744 void SetPerViewportPlotWeight(ON_UUID viewport_id, double plot_weight_mm); 00745 00746 /* use ON_Layer::SetPerViewportPlotWeight */ 00747 ON_DEPRECATED void SetPlotWeight(double, const ON_UUID& ); 00748 00749 /* 00750 Description: 00751 Remove any per viewport plot weight setting so the 00752 layer's overall setting will be used for all viewports. 00753 Parameters: 00754 viewport_id - [in] 00755 If viewport_id is not nil, then the setting for this 00756 viewport will be deleted. If viewport_id is nil, 00757 the all per viewport plot weight settings will be removed. 00758 */ 00759 void DeletePerViewportPlotWeight( const ON_UUID& viewport_id ); 00760 00761 /* 00762 Description: 00763 Use UpdateViewportIds() to change viewport ids in situations 00764 like merging when a viewport id conflict requires the viewport 00765 ids in a file to be changed. 00766 Returns: 00767 Number of viewport ids that were updated. 00768 */ 00769 int UpdateViewportIds( 00770 const ON_UuidPairList& viewport_id_map 00771 ); 00772 00773 public: 00774 00775 int m_layer_index; // index of this layer 00776 ON_UUID m_layer_id; 00777 ON_UUID m_parent_layer_id; // Layers are origanized in a hierarchical 00778 // structure (like file folders). 00779 // If a layer is in a parent layer, 00780 // then m_parent_layer_id is the id of 00781 // the parent layer. 00782 00783 int m_iges_level; // IGES level number if this layer was made during IGES import 00784 00785 00786 00787 // Rendering material: 00788 // If you want something simple and fast, set 00789 // m_material_index to the index of your rendering material 00790 // and ignore m_rendering_attributes. 00791 // If you are developing a fancy plug-in renderer, and a user is 00792 // assigning one of your fabulous rendering materials to this 00793 // layer, then add rendering material information to the 00794 // m_rendering_attributes.m_materials[] array. 00795 // 00796 // Developers: 00797 // As soon as m_rendering_attributes.m_materials[] is not empty, 00798 // rendering material queries slow down. Do not populate 00799 // m_rendering_attributes.m_materials[] when setting 00800 // m_material_index will take care of your needs. 00801 int m_material_index; 00802 ON_RenderingAttributes m_rendering_attributes; 00803 00804 int m_linetype_index; // index of linetype 00805 00806 // Layer display attributes. 00807 // If m_display_material_id is nil, then m_color is the layer color 00808 // and defaults are used for all other display attributes. 00809 // If m_display_material_id is not nil, then some complicated 00810 // scheme is used to decide what objects on this layer look like. 00811 // In all cases, m_color is a good choice if you don't want to 00812 // deal with m_display_material_id. In Rhino, m_display_material_id 00813 // is used to identify a registry entry that contains user specific 00814 // display preferences. 00815 ON_Color m_color; 00816 ON_UUID m_display_material_id; 00817 00818 // Layer printing (plotting) attributes. 00819 ON_Color m_plot_color; // printing color 00820 // ON_UNSET_COLOR means use layer color 00821 double m_plot_weight_mm; // printing pen thickness in mm 00822 // 0.0 means use the default width (a Rhino app setting) 00823 // -1.0 means layer does not print (still visible on screen) 00824 ON_wString m_name; 00825 00826 bool m_bVisible; // If true, objects on this layer are visible. 00827 bool m_bLocked; // If true, objects on this layer cannot be modified. 00828 bool m_bExpanded; // If true, when the layer table is displayed in 00829 // a tree control then the list of child layers is 00830 // shown in the control. 00831 00832 00834 // 00835 // Tools for saving layer settings. 00836 // 00837 enum LAYER_SETTINGS 00838 { 00839 no_layer_settings = 0, 00840 userdata_settings = 1, 00841 color_settings = 2, 00842 plot_color_settings = 4, 00843 plot_weight_settings = 8, 00844 visible_settings = 16, 00845 locked_settings = 32, 00846 all_layer_settings = 0xFFFFFFFF 00847 }; 00848 00849 /* 00850 Returns: 00851 Bits in the returned value indicate if there are differences 00852 between layer0 and layer1. For example, if the layers have 00853 difference color, then the returned value would have the 00854 "color" bit set. 00855 */ 00856 static unsigned int Differences( const ON_Layer& layer0, const ON_Layer& layer1 ); 00857 00858 /* 00859 Description: 00860 Use settings_values and settings to set the specified values 00861 on this layer. 00862 Parameters: 00863 settings_values - [in] 00864 settings - [in] 00865 LAYER_SETTINGS bits specify which values of this 00866 should be set from settings_values. 00867 */ 00868 void Set( unsigned int settings, const ON_Layer& settings_values ); 00869 00870 /* 00871 Description: 00872 Saves current values of the specified settings so 00873 they can be retrieved by GetSettings(). 00874 Parameters: 00875 settings - [in] 00876 LAYER_SETTINGS bits specify which values to save. 00877 if 0 == settings, then all saved settings are deleted. 00878 bUpdate - [in] 00879 If true, then previously saved settings for properties 00880 not identified by the settings paramter are left intact. 00881 If false, all previously saved settings are removed. 00882 */ 00883 void SaveSettings( unsigned int settings, bool bUpdate ); 00884 00885 /* 00886 Returns: 00887 0 if the layer does not have saved settings. 00888 Nonzero value with LAYER_SETTINGS bits specifying which settings 00889 are saved. The saved that can be retrieved by calling 00890 GetSavedSettings(). 00891 */ 00892 unsigned int SavedSettings() const; 00893 00894 /* 00895 Description: 00896 Gets values of the saved settings. 00897 Parameters: 00898 layer - [in/out] 00899 values of saved settings are set and all other values are 00900 left unchanged. 00901 settings - [out] 00902 LAYER_SETTINGS bits specify which layer values were set 00903 by this call. 00904 Returns: 00905 True if there were saved settings. 00906 */ 00907 bool GetSavedSettings( ON_Layer& layer, unsigned int& settings ) const; 00908 00909 private: 00910 // The following information may not be accurate and is subject 00911 // to change at any time. 00912 // 00913 // m_extension_bits & 0x01: 00914 // The value of ( m_extension_bits & 0x01) is used to speed 00915 // common per viewport visiblity and color queries. 00916 // 0x00 = there may be per viewport settings on this layer. 00917 // 0x01 = there are no per viewport settings on this layer. 00918 // 00919 // m_extension_bits & 0x06: 00920 // The value of ( m_extension_bits & 0x06) is the persistent 00921 // visibility setting for this layer. 00922 // 0x00 = no persistent visibility setting 00923 // 0x02 = persistent visibility = true 00924 // 0x04 = persistent visibility = false 00925 // 0x06 = invalid value - treated as 0x00 00926 // 00927 // m_extension_bits & 0x18: 00928 // The value of ( m_extension_bits & 0x18) is the persistent 00929 // locking setting for this layer. 00930 // 0x00 = no persistent locking setting 00931 // 0x08 = persistent locking = true 00932 // 0x10 = persistent locking = false 00933 // 0x18 = invalid value - treated as 0x00 00934 unsigned char m_extension_bits; 00935 }; 00936 00937 00938 #endif 00939