AttrRadialFill Class Reference

Radial Graduated Fill Attribute class. More...

#include <fillattr2.h>

Inheritance diagram for AttrRadialFill:

AttrFillGeometry NodeAttribute NodeRenderable Node CCObject SimpleCCObject AttrRadialColourFill AttrRadialTranspFill AttrCircularColourFill AttrCircularTranspFill List of all members.

Public Member Functions

 AttrRadialFill ()
 AttrRadialFill (Node *ContextNode, AttachNodeDirection Direction, BOOL Locked=FALSE, BOOL Mangled=FALSE, BOOL Marked=FALSE, BOOL Selected=FALSE)
virtual void Transform (TransformBase &)
 Transform a grad fill attribute by moving the start and end points.
virtual BOOL CanTransform ()
 Indicate that this attribute can be transformed.
virtual void RenderFillBlobs (RenderRegion *pRender)
virtual void RenderFillMesh (RenderRegion *, DocCoord *, BOOL *, INT32 NumControlPoints=0)
virtual void OnControlDrag (DocCoord, FillControl &, ClickModifiers)
virtual AttributeValueGetAttributeValue ()=0
virtual DocRect GetBlobBoundingRect ()
 Calculates the bounding rectangle of the attrs blobs.This should always be calculated on the fly as the view scale can change without the attr knowing, giving an incorrect result.
virtual ANGLE GetSecondaryAngle ()
virtual FillControl CheckForControlHit (DocCoord &)
 Check to see if a click was on a Fill Control Point.
void MakeCircular ()
 Makes this fill into a circular one.
void MakeElliptical ()
 Makes this fill into an elliptical one.
BOOL IsCircular ()
BOOL IsElliptical ()
virtual FillControl TestColourDrop (AttrColourDrop *)
 Check to see which colour will be changed if dropped at this point.
virtual BOOL IsAGradFill () const
 Virtual function for determining if the node is an attribute.
virtual BOOL NeedsToRenderAtEachBrushStroke () const
 So that don't have to keep re-rendering attributes whilst drawing a brush, this identifies whether or not the attribute need to be rendered at each step, e.g. radial fills.
virtual INT32 GetNumberOfControlPoints ()
virtual void TransformTranslateObject (const ExtendParams &ExtParams)
 Override of AttrFillGeometry::TransformTranslateObject(). See that method for more info.

Protected Member Functions

virtual void ValidateAttributeValue ()
 Makes sure the Coords of the Fill are sensible.

Detailed Description

Radial Graduated Fill Attribute class.

Author:
Tim_Browse (Xara Group Ltd) <camelotdev@xara.com>
Date:
18/07/94
See also:
RadialFillAttribute

Definition at line 867 of file fillattr2.h.


Constructor & Destructor Documentation

AttrRadialFill::AttrRadialFill  )  [inline]
 

Definition at line 872 of file fillattr2.h.

00872 : AttrFillGeometry() {}

AttrRadialFill::AttrRadialFill Node ContextNode,
AttachNodeDirection  Direction,
BOOL  Locked = FALSE,
BOOL  Mangled = FALSE,
BOOL  Marked = FALSE,
BOOL  Selected = FALSE
[inline]
 

Definition at line 873 of file fillattr2.h.

00878                                      : 
00879         AttrFillGeometry(ContextNode, Direction, Locked, Mangled, Marked, Selected) {}


Member Function Documentation

BOOL AttrRadialFill::CanTransform  )  [virtual]
 

Indicate that this attribute can be transformed.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/8/94
Returns:
TRUE => transform this attribute.
See also:
NodeRenderable::CanTransform

Reimplemented from NodeRenderable.

Definition at line 7181 of file fillattr.cpp.

07182 {
07183     return TRUE;
07184 }

FillControl AttrRadialFill::CheckForControlHit DocCoord ClickPos  )  [virtual]
 

Check to see if a click was on a Fill Control Point.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/07/94
Parameters:
ClickPos,The DocCoord position to check. [INPUTS]
Returns:
A FillControl, indicating the Fill Control Point Hit, or FILLCONTROL_NULL, if no points hit.
See also:
FillControl

Reimplemented from AttrFillGeometry.

Definition at line 7524 of file fillattr.cpp.

07525 {
07526 #if !defined(EXCLUDE_FROM_RALPH)
07527     if (!GetApplication()->GetBlobManager()->GetCurrentInterest().Fill || !IsVisible())
07528         return FILLCONTROL_NULL;
07529 
07530     return AttrFillGeometry::CheckForControlHit(ClickPos);
07531 
07532     // Set up a default, that indicates not control points hit
07533     FillControl HitControl = FILLCONTROL_NULL;
07534     DocRect BlobRect;
07535 
07536     // Get the current control positions
07537     DocCoord CentrePoint  = *GetStartPoint();
07538     DocCoord EndColBlob   = *GetEndPoint();
07539     DocCoord End2ColBlob  = *GetEndPoint2();
07540 
07541     // Get the rectangle around the Centre Control Point
07542     (Camelot.GetBlobManager())->GetBlobRect(CentrePoint, &BlobRect);
07543     // See if the Click Position is within the rectangle
07544     if ( BlobRect.ContainsCoord(ClickPos) )
07545         HitControl = FILLCONTROL_STARTPOINT;
07546 
07547     // Get the rectangle around the End Control Point
07548     (Camelot.GetBlobManager())->GetBlobRect(EndColBlob, &BlobRect);
07549     // See if the Click Position is within the rectangle
07550     if ( BlobRect.ContainsCoord(ClickPos) )
07551         HitControl = FILLCONTROL_ENDPOINT;
07552 
07553     if (IsElliptical())
07554     {
07555         // Only elliptical fills have a second end point
07556         
07557         // Get the rectangle around the Senond End Control Point
07558         (Camelot.GetBlobManager())->GetBlobRect(End2ColBlob, &BlobRect);
07559         // See if the Click Position is within the rectangle
07560         if ( BlobRect.ContainsCoord(ClickPos) )
07561             HitControl = FILLCONTROL_SECONDARYPOINT;
07562     }
07563 
07564     return HitControl;
07565 #else
07566     return FILLCONTROL_NULL;
07567 #endif
07568 }

virtual AttributeValue* AttrRadialFill::GetAttributeValue  )  [pure virtual]
 

Implements AttrFillGeometry.

Implemented in AttrRadialColourFill, and AttrRadialTranspFill.

DocRect AttrRadialFill::GetBlobBoundingRect  )  [virtual]
 

Calculates the bounding rectangle of the attrs blobs.This should always be calculated on the fly as the view scale can change without the attr knowing, giving an incorrect result.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
28/7/94
Returns:
DocRect - The rectangle that contains all the nodes selection blobs.

Reimplemented from AttrFillGeometry.

Definition at line 7439 of file fillattr.cpp.

07440 {
07441 #if !defined(EXCLUDE_FROM_RALPH)
07442     // Optimisation.  If there is currently no interest in Fill Blobs
07443     // and this fill is not being Dragged (Fill blobs are turned off during
07444     // a fill drag), then we needn't bother doing anything. 
07445     if ( (!GetApplication()->GetBlobManager()->GetCurrentInterest(TRUE).Fill || !IsVisible()) && DraggedFill != this )
07446         return DocRect(0,0, 0,0);
07447 
07448     // Get the Start and End Points
07449     DocCoord StartPoint = *GetStartPoint();
07450     DocCoord EndPoint   = *GetEndPoint();
07451     DocCoord EndPoint2  = *GetEndPoint2();
07452 
07453     // Make a dummy bounds from just the Start Point
07454     DocRect BoundingRect(StartPoint, StartPoint);
07455 
07456     if (DraggedFill == this)
07457     {
07458         // This fill is being dragged, so we have to include the Ellipse bounding
07459         // rect as well
07460         DocRect StartBlobRect;
07461         DocRect EndBlobRect;
07462         
07463         DocRect DragRect = GetMeshEllipseBounds(StartPoint, EndPoint, EndPoint2);
07464 
07465         // Get the Bounding rect of Blobs on each of the ends
07466         (Camelot.GetBlobManager())->GetBlobRect(DragRect.lo, &StartBlobRect);
07467         (Camelot.GetBlobManager())->GetBlobRect(DragRect.hi, &EndBlobRect);
07468 
07469         // Now include the Bottom Left and Top Right of each blob in the Bounds.
07470         // We have to do it like this to make sure that the DocRect's coords
07471         // are valid.  ie. The Hi's are Higher than the Lo's.
07472         BoundingRect.IncludePoint(StartBlobRect.lo);
07473         BoundingRect.IncludePoint(StartBlobRect.hi);
07474         BoundingRect.IncludePoint(EndBlobRect.lo);
07475         BoundingRect.IncludePoint(EndBlobRect.hi);
07476     }
07477     else
07478     {
07479         // We're not being dragged, so just calc the bounds of the Start and End Blobs
07480         DocRect StartBlobRect;
07481         DocRect EndBlobRect;
07482         DocRect End2BlobRect;
07483 
07484         // Get the Bounding rect of the Fill Line, including the Blobs on the ends
07485         (Camelot.GetBlobManager())->GetBlobRect(StartPoint, &StartBlobRect);
07486         (Camelot.GetBlobManager())->GetBlobRect(EndPoint, &EndBlobRect);
07487         (Camelot.GetBlobManager())->GetBlobRect(EndPoint2, &End2BlobRect);
07488 
07489         // Now include the Bottom Left and Top Right of each blob in the Bounds.
07490         // We have to do it like this to make sure that the DocRect's coords
07491         // are valid.  ie. The Hi's are Higher than the Lo's.
07492         BoundingRect.IncludePoint(StartBlobRect.lo);
07493         BoundingRect.IncludePoint(StartBlobRect.hi);
07494         BoundingRect.IncludePoint(EndBlobRect.lo);
07495         BoundingRect.IncludePoint(EndBlobRect.hi);
07496         BoundingRect.IncludePoint(End2BlobRect.lo);
07497         BoundingRect.IncludePoint(End2BlobRect.hi);
07498     }
07499 
07500     IncludeArrowHead(&BoundingRect, StartPoint, EndPoint);
07501     IncludeArrowHead(&BoundingRect, StartPoint, EndPoint2);
07502 
07503     // and return it
07504     return BoundingRect;
07505 #else
07506     return DocRect(0,0, 0,0);
07507 #endif
07508 }

virtual INT32 AttrRadialFill::GetNumberOfControlPoints  )  [inline, virtual]
 

Reimplemented from AttrFillGeometry.

Definition at line 910 of file fillattr2.h.

00910 { return IsCircular() ? 2 : 3; }

virtual ANGLE AttrRadialFill::GetSecondaryAngle  )  [inline, virtual]
 

Reimplemented from AttrFillGeometry.

Definition at line 893 of file fillattr2.h.

00893 { return 90; }

virtual BOOL AttrRadialFill::IsAGradFill  )  const [inline, virtual]
 

Virtual function for determining if the node is an attribute.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
13/2/95
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if the node is a NodeAttribute, will return TRUE

Errors:

Reimplemented from NodeAttribute.

Definition at line 905 of file fillattr2.h.

00905 { return TRUE; } 

BOOL AttrRadialFill::IsCircular  )  [inline]
 

Definition at line 900 of file fillattr2.h.

00900 { return ATTRVALUE()->IsAspectLocked(); }

BOOL AttrRadialFill::IsElliptical  )  [inline]
 

Definition at line 901 of file fillattr2.h.

00901 { return !IsCircular(); }

void AttrRadialFill::MakeCircular  ) 
 

Makes this fill into a circular one.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/8/94
See also:
AttrRadialFill::MakeElliptical; AttrRadialFill::IsElliptical; AttrRadialFill::IsCircular

Definition at line 7834 of file fillattr.cpp.

07835 {
07836     ((FillGeometryAttribute*)GetAttributeValue())->SetAspectLock(TRUE);
07837 }

void AttrRadialFill::MakeElliptical  ) 
 

Makes this fill into an elliptical one.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
12/8/94
See also:
AttrRadialFill::MakeCircular; AttrRadialFill::IsElliptical; AttrRadialFill::IsCircular

Definition at line 7852 of file fillattr.cpp.

07853 {
07854     ((FillGeometryAttribute*)GetAttributeValue())->SetAspectLock(FALSE);
07855 }

BOOL AttrRadialFill::NeedsToRenderAtEachBrushStroke  )  const [virtual]
 

So that don't have to keep re-rendering attributes whilst drawing a brush, this identifies whether or not the attribute need to be rendered at each step, e.g. radial fills.

Author:
Diccon_Yamanaka (Xara Group Ltd) <camelotdev@xara.com>
Date:
29/11/99
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if this attribute should be rendered at every step of a brush stroke

Errors: See Also; Brush code (ndbrshmk.cpp)

Reimplemented from NodeAttribute.

Reimplemented in AttrRadialTranspFill.

Definition at line 7204 of file fillattr.cpp.

07205 {
07206     return TRUE;
07207 }

void AttrRadialFill::OnControlDrag DocCoord  ,
FillControl ,
ClickModifiers 
[virtual]
 

Reimplemented from AttrFillGeometry.

Definition at line 7222 of file fillattr.cpp.

07223 {
07224 #if !defined(EXCLUDE_FROM_RALPH)
07225     // Get the current Control Positions
07226     DocCoord StartPoint = *GetStartPoint();
07227     DocCoord EndPoint = *GetEndPoint();
07228     DocCoord EndPoint2 = *GetEndPoint2();
07229 
07230     INT32 dx, dy;
07231 
07232     // Which control point is being dragged ?
07233     switch (DragControl)
07234     {
07235         case FILLCONTROL_STARTPOINT:
07236         
07237             // Someone is dragging the Centre of the Fill
07238             dx = StartPoint.x - Pos.x;
07239             dy = StartPoint.y - Pos.y;
07240             // Move the other points relative
07241             EndPoint.translate(-dx, -dy);
07242             EndPoint2.translate(-dx, -dy);
07243 
07244             SetEndPoint(&EndPoint);
07245             SetEndPoint2(&EndPoint2);
07246             SetStartPoint(&Pos);
07247             break;
07248 
07249         case FILLCONTROL_ENDPOINT:
07250             
07251             // Someone is dragging the first End Point
07252             
07253             // Constrain the angle if necessary
07254             if (ClickMods.Constrain)
07255                 DocView::ConstrainToAngle(StartPoint, &Pos);
07256 
07257             // The Aspect ratio can be locked either by it being circular
07258             // or by the Shift key      
07259             if (IsCircular() || ClickMods.Adjust)
07260             {
07261                 double OldLen = StartPoint.Distance(EndPoint);
07262                 double NewLen = StartPoint.Distance(Pos);
07263                 double Ratio = 1.0;
07264 
07265                 if (OldLen == 0)
07266                     Ratio = 0;
07267                 else
07268                     Ratio = NewLen/OldLen;
07269 
07270                 // Calculate the new end point based on the aspect ratio
07271                 DocCoord temp = MakeLineAtAngle(StartPoint, Pos, 90, INT32(StartPoint.Distance(EndPoint2) * Ratio));
07272                 SetEndPoint2(&temp);
07273             }
07274             else
07275             {
07276                 // Aspect ratio is not locked, so maintain the old line length
07277                 DocCoord temp = MakeLineAtAngle(StartPoint, Pos, 90, INT32(StartPoint.Distance(EndPoint2)));
07278                 SetEndPoint2(&temp);
07279             }
07280 
07281             SetEndPoint(&Pos);
07282             break;
07283 
07284         case FILLCONTROL_SECONDARYPOINT:
07285 
07286             // Someone is dragging the second End Point
07287             
07288             // Constrain the angle if necessary
07289             if (ClickMods.Constrain)
07290                 DocView::ConstrainToAngle(StartPoint, &Pos);
07291 
07292             // The Aspect ratio can be locked either by it being circular
07293             // or by the Shift key      
07294             if (IsCircular() || ClickMods.Adjust)
07295             {
07296                 double OldLen = StartPoint.Distance(EndPoint2);
07297                 double NewLen = StartPoint.Distance(Pos);
07298                 double Ratio = 1.0;
07299 
07300                 if (OldLen == 0)
07301                     Ratio = 0;
07302                 else
07303                     Ratio = NewLen/OldLen;
07304 
07305                 // Calculate the new end point based on the aspect ratio
07306                 DocCoord temp = MakeLineAtAngle(StartPoint, Pos, -90, INT32(StartPoint.Distance(EndPoint) * Ratio));
07307                 SetEndPoint(&temp);
07308             }
07309             else
07310             {
07311                 // Aspect ratio is not locked, so maintain the old line length
07312                 DocCoord temp = MakeLineAtAngle(StartPoint, Pos, -90, INT32(StartPoint.Distance(EndPoint)));
07313                 SetEndPoint(&temp);
07314             }
07315 
07316             SetEndPoint2(&Pos);
07317             break;
07318         default:
07319             // check for dragging a ramp point
07320             if (ISA_RAMPINDEX(DragControl))
07321             {
07322                 AttrFillGeometry::OnControlDrag( Pos, DragControl, ClickMods);
07323             }
07324             break;
07325     }
07326 #endif
07327 }

virtual void AttrRadialFill::RenderFillBlobs RenderRegion pRender  )  [inline, virtual]
 

Reimplemented from AttrFillGeometry.

Reimplemented in AttrRadialColourFill, and AttrRadialTranspFill.

Definition at line 885 of file fillattr2.h.

00885 {}

void AttrRadialFill::RenderFillMesh RenderRegion ,
DocCoord ,
BOOL *  ,
INT32  NumControlPoints = 0
[virtual]
 

Reimplemented from AttrFillGeometry.

Definition at line 7587 of file fillattr.cpp.

07590 {
07591 #if !defined(EXCLUDE_FROM_RALPH)
07592     if (AllowRampRedraw == FALSE)
07593     {
07594         FillRamp *pRamp = GetFillRamp();
07595         if (pRamp)
07596         {
07597             pRamp->RenderSelectedBlob (ATTRVALUE(), pRender);
07598         }
07599         
07600         return;
07601     }
07602     
07603     DocCoord Start = ControlPoints[FILLCONTROL_STARTPOINT];
07604     DocCoord End   = ControlPoints[FILLCONTROL_ENDPOINT];
07605 
07606     if (Start == End)
07607         return;
07608 
07609     if (SelState == NULL)
07610     {
07611         // If no selection state passed in, then assume
07612         // all the points are deselected
07613         BOOL Selected[NUMCONTROLPOINTS];
07614         for (INT32 i=0; i< NumControlPoints; i++)
07615         {
07616             Selected[i] = FALSE;
07617         }
07618         SelState = Selected;
07619     }
07620 
07621     DocCoord End2  = ControlPoints[FILLCONTROL_SECONDARYPOINT];
07622 
07623     // Remember what attributes were here before
07624     pRender->SaveContext();
07625 
07626     // Get the current blob size in Doc Units
07627     INT32 BlobSize = (Camelot.GetBlobManager())->GetBlobSize();
07628 
07629     // Calculate the Arrow on the End of the Line
07630     Path ArrowPath;
07631     ArrowPath.Initialise();
07632     DocCoord LineEnd;
07633     MakeMeshArrow(&ArrowPath, Start, End, &LineEnd);
07634     // This will have also calculated a point for us to draw
07635     // the line to, so we don't try and draw though the arrow head.
07636 
07637     Path ArrowPath2;
07638     DocCoord LineEnd2;
07639 
07640     if (IsElliptical())
07641     {
07642         // Calculate the Arrow on the End of the Line2
07643         ArrowPath2.Initialise();
07644         MakeMeshArrow(&ArrowPath2, Start, End2, &LineEnd2);
07645     }
07646 
07647     // Set the line colours etc as we need them
07648     pRender->SetLineWidth(0);
07649     pRender->SetLineColour(COLOUR_UNSELECTEDBLOB);
07650     pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
07651 
07652     // First Draw the Line
07653     pRender->SetLineWidth(BlobSize/4);
07654     pRender->DrawLine(Start, LineEnd);
07655 
07656     // Draw the secondary line if needed
07657     if (IsElliptical())
07658         pRender->DrawLine(Start, LineEnd2);
07659 
07660     // Render an Arrow at the end of the line
07661     pRender->SetLineWidth(0);
07662     pRender->SetLineColour(COLOUR_NONE);
07663     pRender->DrawPath(&ArrowPath);
07664 
07665     // Render arrow on the end of line2 if its there
07666     if (IsElliptical())
07667         pRender->DrawPath(&ArrowPath2);
07668 
07669     if (DraggedFill == this)
07670     {
07671         if (AllowBoundsRedraw)
07672         {
07673             // This fill is being dragged, so draw an Ellipse to show the
07674             // shape of the fill
07675             pRender->SetLineColour(COLOUR_SELECTEDBLOB);
07676             pRender->SetFillColour(COLOUR_NONE);
07677         
07678             Path EllipsePath;
07679             EllipsePath.Initialise();
07680             // Make an Elliptical path
07681             MakeMeshEllipse(&EllipsePath, Start, End, End2);
07682 
07683             pRender->DrawPath(&EllipsePath);
07684         }
07685     }
07686 
07687     // Now Render the blobs on the path
07688 
07689     // Draw a blob at the start point
07690     if (SelState[FILLCONTROL_STARTPOINT])
07691     {
07692         // Draw Selected Blob
07693 //      pRender->SetLineColour(COLOUR_SELECTEDBLOB);
07694         pRender->SetLineColour(COLOUR_NONE);
07695         pRender->SetFillColour(COLOUR_SELECTEDBLOB);
07696         pRender->DrawBlob(Start, BT_SELECTED);
07697     }
07698     else
07699     {
07700         // Draw Unselected Blob
07701 //      pRender->SetLineColour(COLOUR_UNSELECTEDBLOB);
07702         pRender->SetLineColour(COLOUR_NONE);
07703         pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
07704         pRender->DrawBlob(Start, BT_UNSELECTED);
07705     }
07706 
07707     // Draw a blob at the end point
07708     if (SelState[FILLCONTROL_ENDPOINT])
07709     {
07710         // Draw Selected Blob
07711 //      pRender->SetLineColour(COLOUR_SELECTEDBLOB);
07712         pRender->SetLineColour(COLOUR_NONE);
07713         pRender->SetFillColour(COLOUR_SELECTEDBLOB);
07714         pRender->DrawBlob(End, BT_SELECTED);
07715         if (IsElliptical())
07716             pRender->DrawBlob(End2,BT_SELECTED);
07717     }
07718     else
07719     {
07720         // Draw Unselected Blob
07721 //      pRender->SetLineColour(COLOUR_UNSELECTEDBLOB);
07722         pRender->SetLineColour(COLOUR_NONE);
07723         pRender->SetFillColour(COLOUR_UNSELECTEDBLOB);
07724         pRender->DrawBlob(End, BT_UNSELECTED);
07725         if (IsElliptical())
07726             pRender->DrawBlob(End2,BT_UNSELECTED);
07727     }
07728 
07729     // now render any ramp blobs
07730     FillRamp *pRamp = GetFillRamp();
07731     if (pRamp)
07732         pRamp->RenderRampBlobs(ATTRVALUE(), pRender, NULL);
07733 
07734     // Put all the old attributes back
07735     pRender->RestoreContext();
07736 #endif
07737 }

FillControl AttrRadialFill::TestColourDrop AttrColourDrop ColDrop  )  [virtual]
 

Check to see which colour will be changed if dropped at this point.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/2/95

Reimplemented from AttrFillGeometry.

Definition at line 5412 of file fillattr.cpp.

05413 { 
05414 #if !defined(EXCLUDE_FROM_RALPH)
05415     return AttrFillGeometry::TestColourDrop(ColDrop);
05416 
05417     // So, where was it dropped (or where will it be dropped)
05418     DocCoord DropPoint = ColDrop->GetDropPoint();
05419 
05420     // Look to see if the DropPoint is over any of the Fill Control Points
05421     FillControl ControlHit = CheckForControlHit(DropPoint);
05422     
05423     // If it hit one of our control points, then use that
05424     if (ControlHit != FILLCONTROL_NULL)
05425         return ControlHit;
05426 
05427     // It didn't hit any of our control points, so if the drop is over
05428     // the object then we'll make a guess as to which control point
05429     // the user would like to change, depending on which area of the
05430     // object the pointer is over.
05431 
05432     // First make sure we're actually over an object
05433     NodeRenderableInk* pParentObject = ColDrop->GetObjectDroppedOn();
05434     if (pParentObject == NULL)
05435         return FILLCONTROL_NULL;    // We're not over any object 
05436 
05437     // Make sure this fill type has some Control Points
05438     if (GetStartPoint() == NULL || GetEndPoint() == NULL)
05439         return FILLCONTROL_NULL;
05440 
05441     DocCoord StartPoint = *GetStartPoint();
05442     DocCoord EndPoint   = *GetEndPoint();
05443     DocCoord EndPoint2  = *GetEndPoint2();
05444 
05445     double MajRadius = EndPoint.Distance(StartPoint);
05446     double MinRadius = EndPoint2.Distance(StartPoint);
05447 
05448     ANGLE MajAngle  = CalcLineAngle(StartPoint, EndPoint)  + 180;
05449     ANGLE DropAngle = CalcLineAngle(StartPoint, DropPoint) + 180;
05450 
05451     ANGLE Diff = DropAngle - MajAngle;
05452 
05453     if (Diff >= 180)    Diff -= 360;
05454     if (Diff <= -180)   Diff += 360;
05455     
05456     Diff = ABS(Diff);
05457     if (Diff > 90)      Diff = 180 - Diff;
05458 
05459     TRACEUSER( "Mike", _T("MajAngle     = %f\n"),MajAngle.MakeDouble());
05460     TRACEUSER( "Mike", _T("DropAngle    = %f\n"),DropAngle.MakeDouble());
05461     TRACEUSER( "Mike", _T("Diff         = %f\n"),Diff.MakeDouble());
05462 
05463     double Radius = MajRadius + ((MinRadius - MajRadius) * (Diff.MakeDouble()/90));
05464     double Dist   = DropPoint.Distance(StartPoint);
05465 
05466     TRACEUSER( "Mike", _T("Radius       = %f\n"),Radius);
05467     TRACEUSER( "Mike", _T("Dist         = %f\n"),Dist);
05468         
05469     // Is the distance from the centre, more than half the radius ?
05470 
05471     if (Dist <= Radius/2)
05472         ControlHit = FILLCONTROL_STARTPOINT;        
05473     else
05474         ControlHit = FILLCONTROL_ENDPOINT;      
05475 
05476     return ControlHit;
05477 #else
05478     return FILLCONTROL_NULL;
05479 #endif
05480 }

void AttrRadialFill::Transform TransformBase Trans  )  [virtual]
 

Transform a grad fill attribute by moving the start and end points.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
23/8/94
Parameters:
Trans - the transform object to apply to this attribute. [INPUTS]
See also:
NodeRenderable::Transform

Reimplemented from NodeRenderable.

Definition at line 7146 of file fillattr.cpp.

07147 {
07148     if ( Trans.TransFills )
07149     {
07150         Trans.Transform( GetStartPoint(), 1);
07151         Trans.Transform( GetEndPoint(), 1);
07152         Trans.Transform( GetEndPoint2(), 1);
07153         
07154         if (IsPerspective())
07155             Trans.Transform( GetEndPoint3(), 1);
07156 
07157         // Ensure the transformed Points are sensible
07158         if (IsCircular() &&
07159             (!AreLinesPerpendicular(GetStartPoint(), GetEndPoint(), GetEndPoint2()) ||
07160             ( ABS( (*GetStartPoint()).Distance(*GetEndPoint()) 
07161                                 - (*GetStartPoint()).Distance(*GetEndPoint2()) ) ) > 5 ))
07162         {
07163             // Oh dear we're not circular any more !!
07164             MakeElliptical();
07165         }
07166     }
07167 }

void AttrRadialFill::TransformTranslateObject const ExtendParams ExtParams  )  [virtual]
 

Override of AttrFillGeometry::TransformTranslateObject(). See that method for more info.

Author:
Karim_MacDonald (Xara Group Ltd) <camelotdev@xara.com>
Date:
14/11/2000
See also: AttrFillGeometry::TransformTranslateObject()

Reimplemented from AttrFillGeometry.

Definition at line 20062 of file fillattr.cpp.

20063 {
20064     // call our base class to do the major extending stuff.
20065     AttrFillGeometry::TransformTranslateObject(ExtParams);
20066 
20067     // if we're a circle, then the extend has left our third control point
20068     // hanging in the air, so we need to pull it back down to earth...
20069     if (IsCircular())
20070     {
20071         DocCoord Start  = *GetStartPoint();
20072         DocCoord End1   = *GetEndPoint();
20073         DocCoord End2   = MakeLineAtAngle(Start, End1, 90, (INT32)Start.Distance(End1));
20074         SetEndPoint2(&End2);
20075     }
20076 }

void AttrRadialFill::ValidateAttributeValue  )  [protected, virtual]
 

Makes sure the Coords of the Fill are sensible.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/8/94

Reimplemented from AttrFillGeometry.

Definition at line 7339 of file fillattr.cpp.

07340 {
07341 #if !defined(EXCLUDE_FROM_RALPH)
07342     if ((*GetStartPoint()) != DocCoord(0,0) && (*GetEndPoint()) != DocCoord(0,0))
07343     {
07344         // If the EndPoint2 is 'NULL' then make it sensible
07345         if (*GetEndPoint2() == DocCoord(0,0))
07346         {
07347             DocCoord temp = MakeLineAtAngle((*GetStartPoint()), (*GetEndPoint()), 90);
07348             SetEndPoint2(&temp);
07349             return;
07350         }
07351         
07352 //      if (IsElliptical())
07353 //      {
07354 //          SetEndPoint2(&MakeLineAtAngle((*GetStartPoint()), (*GetEndPoint()), 90, 
07355 //                              INT32((*GetStartPoint()).Distance((*GetEndPoint2())))));
07356 //      }
07357 //      else
07358         if (IsCircular())
07359         {
07360             // This must be a Circle, so make sure EndPoint2 is on the same
07361             // radius as the other endpoint
07362             DocCoord temp = MakeLineAtAngle((*GetStartPoint()), (*GetEndPoint()), 90);
07363             SetEndPoint2(&temp);
07364         }
07365 
07366         return;
07367     }
07368 
07369     // Make up some sensible defaults
07370     DocRect AttrBounds = DocRect(0,0,0,0);
07371 
07372     INT32 Width  = DEFAULT_FILLWIDTH;
07373     INT32 Height = DEFAULT_FILLHEIGHT;
07374 
07375     // Are we an Orphan ?
07376     if (FindParent() != NULL)
07377     {
07378         // Nope, so we can use Daddies Bounding Box
07379         SelRange* Selected = GetApplication()->FindSelection();
07380                  
07381         if (Selected == NULL || Selected->Count() <= 1)
07382             AttrBounds = ((NodeRenderableBounded*)FindParent())->GetBoundingRect(TRUE);
07383         else
07384             AttrBounds = Selected->GetBoundingRect();
07385 
07386         Width  = AttrBounds.Width();
07387         Height = AttrBounds.Height();
07388     }
07389 
07390     // If the StartPoint is 'NULL' then make all points sensible
07391     if ((*GetStartPoint()) == DocCoord(0,0))
07392     {
07393         // Start in the centre of the bounds
07394         DocCoord temp = CentreOf(AttrBounds);
07395         SetStartPoint(&temp);
07396         // and set End Points to Middle Right, and Middle Top
07397         temp = DocCoord((*GetStartPoint()).x + (Width/2), (*GetStartPoint()).y);
07398         SetEndPoint(&temp);
07399         temp = DocCoord((*GetStartPoint()).x, (*GetStartPoint()).y + (Height/2));
07400         SetEndPoint2(&temp);
07401     }
07402 
07403     // If the EndPoint is 'NULL' then make end points sensible
07404     if ((*GetEndPoint()) == DocCoord(0,0))
07405     {
07406         DocCoord temp = DocCoord((*GetStartPoint()).x + (Width/2), (*GetStartPoint()).y);
07407         SetEndPoint(&temp);
07408         temp = DocCoord((*GetStartPoint()).x, (*GetStartPoint()).y + (Height/2));
07409         SetEndPoint2(&temp);
07410     }
07411 
07412     if ((*GetEndPoint2()) == DocCoord(0,0))
07413     {
07414         DocCoord temp = MakeLineAtAngle((*GetStartPoint()), (*GetEndPoint()), 90, Height/2);
07415         SetEndPoint2(&temp);
07416     }
07417 
07418     if (IsCircular())
07419     {
07420         DocCoord temp = MakeLineAtAngle((*GetStartPoint()), (*GetEndPoint()));
07421         SetEndPoint2(&temp);
07422     }
07423 #endif
07424 }


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