AttrDashPattern Class Reference

Dash Pattern Attribute class. More...

#include <lineattr.h>

Inheritance diagram for AttrDashPattern:

NodeAttribute NodeRenderable Node CCObject SimpleCCObject List of all members.

Public Member Functions

 AttrDashPattern ()
 Default constructor for Join Type Attribute class.
 AttrDashPattern (Node *ContextNode, AttachNodeDirection Direction, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE)
 Creates a DashPattern Attribute.
void Render (RenderRegion *pRender)
 'Renders' a DashPattern attribute.
Node * SimpleCopy ()
 This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes.
virtual INT32 operator== (const NodeAttribute &NodeAttrib)
 A virtual comparison operator. See NodeAttribute::operator== for a description of why it's required.
virtual UINT32 GetAttrNameID (void)
 Returns back a string resource ID describing the attribute.
virtual AttributeValue * GetAttributeValue ()
virtual CCRuntimeClass * GetAttributeType ()
virtual AttrIndex GetAttributeIndex ()
virtual UINT32 GetNodeSize () const
 For finding the size of the node.
void GetDebugDetails (StringBase *Str)
 For obtaining debug information about the Node.
virtual void PolyCopyNodeContents (NodeRenderable *pNodeCopy)
 Polymorphically copies the contents of this node to another.
virtual BOOL WritePreChildrenWeb (BaseCamelotFilter *pFilter)
 Writes the dash pattern record to the filter.
virtual BOOL WritePreChildrenNative (BaseCamelotFilter *pFilter)

Public Attributes

DashPatternAttribute Value

Private Member Functions

void CopyNodeContents (AttrDashPattern *NodeCopy)
 This method copies the node's contents to the node pointed to by NodeCopy.

Detailed Description

Dash Pattern Attribute class.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/7/93
See also:
DashRec

Definition at line 771 of file lineattr.h.


Constructor & Destructor Documentation

AttrDashPattern::AttrDashPattern (   ) 
 

Default constructor for Join Type Attribute class.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/7/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 3579 of file lineattr.cpp.

03579                                  : NodeAttribute()
03580 {
03581 }

AttrDashPattern::AttrDashPattern (  Node *  ContextNode,
AttachNodeDirection  Direction,
BOOL  Locked = FALSE,
BOOL  Mangled = FALSE,
BOOL  Marked = FALSE,
BOOL  Selected = FALSE
) 
 

Creates a DashPattern Attribute.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/7/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Definition at line 3554 of file lineattr.cpp.

03560              : NodeAttribute(ContextNode, Direction, Locked, Mangled, Marked, Selected)  
03561 {                         
03562 } 


Member Function Documentation

void AttrDashPattern::CopyNodeContents (  AttrDashPattern *  NodeCopy  )  [private]
 

This method copies the node's contents to the node pointed to by NodeCopy.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/4/93
Parameters:
[INPUTS] 
A copy of this node [OUTPUTS]
Returns:
-

Errors: An assertion failure will occur if NodeCopy is NULL

Scope: protected

Definition at line 3698 of file lineattr.cpp.

03699 {
03700     NodeAttribute::CopyNodeContents( NodeCopy );
03701     NodeCopy->Value.DashPattern = Value.DashPattern; 
03702 } 

virtual AttrIndex AttrDashPattern::GetAttributeIndex (   )  [inline, virtual]
 

Reimplemented from NodeAttribute.

Definition at line 793 of file lineattr.h.

00793 { return ATTR_DASHPATTERN; }

virtual CCRuntimeClass* AttrDashPattern::GetAttributeType (   )  [inline, virtual]
 

Reimplemented from NodeAttribute.

Definition at line 791 of file lineattr.h.

00791 { return CC_RUNTIME_CLASS(AttrDashPattern); }

virtual AttributeValue* AttrDashPattern::GetAttributeValue (   )  [inline, virtual]
 

Reimplemented from NodeAttribute.

Definition at line 790 of file lineattr.h.

00790 { return &Value; }

UINT32 AttrDashPattern::GetAttrNameID (  void   )  [virtual]
 

Returns back a string resource ID describing the attribute.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/2/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
Attribute description ID

Errors: -

See also:
-

Reimplemented from NodeAttribute.

Definition at line 3674 of file lineattr.cpp.

03675 {
03676     return (_R(IDS_DASH_PATTERN)); 
03677 }                                

void AttrDashPattern::GetDebugDetails (  StringBase *  Str  )  [virtual]
 

For obtaining debug information about the Node.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/9/93
Parameters:
Str,: String giving debug info about the node [OUTPUTS]

Reimplemented from NodeRenderable.

Definition at line 3748 of file lineattr.cpp.

03749 {
03750 #ifdef _DEBUG
03751     NodeAttribute::GetDebugDetails( Str );
03752 
03753     String_256 TempStr;
03754 
03755     TempStr._MakeMsg( TEXT("\r\nDash ID=#1%ld\r\n"), Value.DashPattern.GetDashID() );
03756     (*Str) += TempStr;
03757     
03758     TempStr._MakeMsg( TEXT("\r\nLine width=#1%ld\r\n"), Value.DashPattern.LineWidth );
03759     (*Str) += TempStr;
03760     if (Value.DashPattern.ShouldScaleWithLineWidth())
03761         (*Str) += TEXT("Scale with line width\r\n");
03762     else
03763         (*Str) += TEXT("Don't scale with line width\r\n");
03764 
03765     TempStr._MakeMsg( TEXT("Dash start=#1%ld\r\n"), Value.DashPattern.DashStart );
03766     (*Str) += TempStr;
03767 
03768     INT32 Elements  = Value.DashPattern.Elements;
03769     TempStr._MakeMsg( TEXT("Elements=#1%ld\r\n"), Elements );
03770     (*Str) += TempStr;
03771 
03772     INT32* DashArray = Value.DashPattern.ElementData;
03773     for (INT32 el = 0; el < Elements; el++)
03774     {
03775         TempStr._MakeMsg( TEXT("\t=#1%ld\r\n"), DashArray[el]);
03776         (*Str) += TempStr;
03777     }           
03778     
03779 #endif
03780 }

UINT32 AttrDashPattern::GetNodeSize (   )  const [virtual]
 

For finding the size of the node.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/10/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The size of the node in bytes
See also:
Node::GetSubtreeSize

Reimplemented from Node.

Definition at line 3797 of file lineattr.cpp.

03798 {     
03799     return (sizeof(AttrDashPattern)); 
03800 }  

INT32 AttrDashPattern::operator== (  const NodeAttribute &  Attrib  )  [virtual]
 

A virtual comparison operator. See NodeAttribute::operator== for a description of why it's required.

Author:
Simon_Maneggio (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/2/94
Parameters:
Atrib,: The attribute to compare, which must be an AttrDashPattern [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: An ENSURE failure will occur if Attrib does not have a AttrDashPattern runtime class.

See also:
NodeAttribute::operator==

Reimplemented from NodeAttribute.

Definition at line 3649 of file lineattr.cpp.

03650 {
03651     ENSURE(Attrib.IsKindOf(CC_RUNTIME_CLASS(AttrDashPattern)),
03652         "Trying to compare two objects with different types"); 
03653 
03654     AttrDashPattern* Attr = (AttrDashPattern*) &Attrib;
03655     return (Attr->Value.DashPattern == Value.DashPattern); 
03656 }

void AttrDashPattern::PolyCopyNodeContents (  NodeRenderable *  pNodeCopy  )  [virtual]
 

Polymorphically copies the contents of this node to another.

Author:
Phil_Martin (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/12/2003
Parameters:
- [OUTPUTS]
Returns:
Errors: An assertion failure will occur if NodeCopy is NULL Scope: protected

Reimplemented from NodeRenderable.

Definition at line 3718 of file lineattr.cpp.

03719 {
03720     ENSURE(pNodeCopy, "Trying to copy a node's contents into a NULL node");
03721     ENSURE(IS_A(pNodeCopy, AttrDashPattern), "PolyCopyNodeContents given wrong dest node type");
03722 
03723     if (IS_A(pNodeCopy, AttrDashPattern))
03724         CopyNodeContents((AttrDashPattern*)pNodeCopy);
03725 }

void AttrDashPattern::Render (  RenderRegion *  pRender  )  [virtual]
 

'Renders' a DashPattern attribute.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/7/93
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from NodeAttribute.

Definition at line 3598 of file lineattr.cpp.

03599 {
03600     pRender->SetDashPattern(&Value, FALSE);
03601 }

Node * AttrDashPattern::SimpleCopy (  void   )  [virtual]
 

This method returns a shallow copy of the node with all Node pointers NULL. The function is virtual, and must be defined for all derived classes.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/7/93
Parameters:
- [INPUTS]
[OUTPUTS] 
Returns:
A copy of the node, or NULL if memory runs out

Errors: If memory runs out when trying to copy, then ERROR is called with an out of memory error and the function returns NULL.

Scope: protected

Reimplemented from NodeAttribute.

Definition at line 3622 of file lineattr.cpp.

03623 {
03624     AttrDashPattern* NodeCopy = new AttrDashPattern();
03625     ERRORIF(NodeCopy == NULL, _R(IDE_NOMORE_MEMORY), NULL); 
03626     CopyNodeContents(NodeCopy);
03627     return NodeCopy;
03628 }    

BOOL AttrDashPattern::WritePreChildrenNative (  BaseCamelotFilter *  pFilter  )  [virtual]
 

Reimplemented from Node.

Definition at line 3913 of file lineattr.cpp.

03914 {
03915 #ifdef DO_EXPORT
03916     return WritePreChildrenWeb(pFilter);
03917 #else
03918     return FALSE;
03919 #endif
03920 }

BOOL AttrDashPattern::WritePreChildrenWeb (  BaseCamelotFilter *  pFilter  )  [virtual]
 

Writes the dash pattern record to the filter.

> virtual BOOL AttrDashPattern::WritePreChildrenWeb(BaseCamelotFilter* pFilter)

Author:
Mark_Neves (Xara Group Ltd) <camelotdev@xara.com>
Date:
30/5/96
Parameters:
pFilter = ptr to the filter [INPUTS]
Returns:
TRUE if record is written, FALSE if not
See also:
-

Reimplemented from Node.

Definition at line 3817 of file lineattr.cpp.

03818 {
03819 #ifdef DO_EXPORT
03820     ERROR2IF(pFilter == NULL,FALSE,"NULL filter param");
03821 
03822     INT32 DashType = 0;
03823     INT32 Pattern = Value.DashPattern.GetDashID();
03824     
03825     BOOL ok = TRUE;
03826 
03827     if (Pattern != 0)
03828     {
03829         // We can save it simply using the ID
03830         switch ((StockDash)Pattern)
03831         {
03832             case SD_SOLID  : DashType = REF_DASH_SOLID; break;
03833             case SD_DASH1  : DashType = REF_DASH_1; break;
03834             case SD_DASH2  : DashType = REF_DASH_2; break;
03835             case SD_DASH3  : DashType = REF_DASH_3; break;
03836             case SD_DASH4  : DashType = REF_DASH_4; break;
03837             case SD_DASH5  : DashType = REF_DASH_5; break;
03838             case SD_DASH6  : DashType = REF_DASH_6; break;
03839             case SD_DASH7  : DashType = REF_DASH_7; break;
03840             case SD_DASH8  : DashType = REF_DASH_8; break;
03841             case SD_DASH9  : DashType = REF_DASH_9; break;
03842             case SD_DASH10 : DashType = REF_DASH_10; break;
03843             case SD_DASH11 : DashType = REF_DASH_11; break;
03844             case SD_DASH12 : DashType = REF_DASH_12; break;
03845             case SD_DASH13 : DashType = REF_DASH_13; break;
03846             case SD_DASH14 : DashType = REF_DASH_14; break;
03847             case SD_DASH15 : DashType = REF_DASH_15; break;
03848             case SD_DASH16 : DashType = REF_DASH_16; break;
03849             case SD_DASH17 : DashType = REF_DASH_17; break;
03850             case SD_DASH18 : DashType = REF_DASH_18; break;
03851             case SD_DASH19 : DashType = REF_DASH_19; break;
03852             case SD_DASH20 : DashType = REF_DASH_20; break;
03853             case SD_DASH_GUIDELAYER : DashType = REF_DASH_GUIDELAYER; break;
03854             default:
03855                 ERROR3("Unkown dash type in AttrDashPattern::WritePreChildrenWeb");
03856         }
03857 
03858         // Save out the simple dash id details
03859         CamelotFileRecord Rec(pFilter,TAG_DASHSTYLE,TAG_DASHSTYLE_SIZE);
03860         ok = Rec.Init();
03861         if (ok) ok = Rec.WriteINT32(DashType);
03862         if (ok) ok = pFilter->Write(&Rec);
03863     }
03864     else
03865     {
03866         // Output the definition
03867         // Is it a scaled sort?
03868         BOOL DoScale    = Value.DashPattern.ShouldScaleWithLineWidth();
03869         INT32 Tag       = TAG_DEFINEDASH;
03870         if (DoScale)
03871             Tag         = TAG_DEFINEDASH_SCALED;
03872         
03873         INT32 DashStart = Value.DashPattern.DashStart;
03874         INT32 LineWidth = Value.DashPattern.LineWidth;
03875         INT32 Elements  = Value.DashPattern.Elements;
03876         INT32* DashArray = Value.DashPattern.ElementData;
03877 
03878         // Don't bother with zero width lines
03879         //if (LineWidth == 0)
03880         //  Elements = 0;
03881         
03882         //FIXED16 Scale = 1;
03883         //if (DoScale)
03884         //{
03885         //  Scale = (double(LineWidth) / double(RR_DASHPATTERN().LineWidth));
03886         //}
03887 
03888         CamelotFileRecord Rec(pFilter,Tag, CXF_UNKNOWN_SIZE);
03889         ok = Rec.Init();
03890         if (ok) ok = Rec.WriteINT32(DashStart);
03891         if (ok) ok = Rec.WriteINT32(LineWidth);
03892         if (ok) ok = Rec.WriteINT32(Elements);
03893         if (ok && Elements > 0)
03894         {
03895             for (INT32 el = 0; el < Elements; el++)
03896             {
03897                 if (ok) ok = Rec.WriteINT32(DashArray[el]);
03898             }           
03899         }
03900 
03901         if (ok) ok = pFilter->Write(&Rec);
03902     }
03903 
03904     return ok;
03905 #else
03906     return FALSE;
03907 #endif // DO_EXPORT
03908 }


Member Data Documentation

DashPatternAttribute AttrDashPattern::Value
 

Definition at line 812 of file lineattr.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:50:12 2007 for Camelot by  doxygen 1.4.4