InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PMPathPoint.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: jargast
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //
23 // A Generic class that describes a line point or a Bezier knot
24 //
25 //========================================================================================
26 
27 #ifndef __PMPathPoint__
28 #define __PMPathPoint__
29 
30 #include "PMPoint.h"
31 #include "PathTypes.h"
32 
33 class IPMStream;
34 class PMRect;
35 class PMPathPoint;
36 class PMMatrix;
37 
38 typedef PMPathPoint PBPMPathPoint ; // path point in "Pasteboard" PMRealinates
40 
41 
45 {
46 public:
47  typedef base_type data_type;
48 
51  constexpr PMPathPoint() noexcept : fAnchorType(kL), fLeftDirPt(0,0), fRightDirPt(0,0), fAnchorPt(0,0)
52  {}
53 
62  PMPathPoint (PMPathPointType pointType, const PMPointList& ptList);
63 
72  PMPathPoint (PMPathPointType pointType, const PMPoint& leftDirPt, const PMPoint& anchorPt, const PMPoint& rightDirPt);
73 
80  PMPathPoint (const PMPointList& ptList);
81 
84  PMPathPoint (const PMPoint& linePt) noexcept;
85 
88  PMPathPoint (const PMPoint& leftDirPt, const PMPoint& anchorPt, const PMPoint& rightDirPt);
89 
92  const PMPoint& GetPoint (PathPointIndex ptIndex) const;
93 
96  const PMPoint& GetLeftDirPoint () const noexcept;
99  const PMPoint& GetAnchorPoint () const noexcept;
102  const PMPoint& GetRightDirPoint () const noexcept;
103 
107  PMPathPointType GetAnchorType() const noexcept;
108 
122  void ModifyPoint
123  (
124  PathPointIndex ptIndex,
125  const PMPoint& newPoint,
126  bool16 bMirrorPt = kFalse,
127  PMRect* constrainRect = nil
128  );
129 
138  void SetPoint( PathPointIndex ptIndex, const PMPoint& newPoint );
142  void SetLeftDirPoint( const PMPoint& newPoint ) noexcept;
146  void SetAnchorPoint( const PMPoint& newPoint ) noexcept;
150  void SetRightDirPoint( const PMPoint& newPoint ) noexcept;
151 
154  void Flip();
155 
161  void ModifyAnchorType (PMPathPointType newType);
162 
167  PMRect GetBoundingBox() const;
168 
172  void TransformPoints (const PMMatrix& xForm);
173 
180  bool16 HitTest( const PMRect& hitRect, PathPointIndex& whichPt, const PMReal& handleSize = 0.0 ) const ;
181 
185  void ReadWrite (IPMStream* iPMStream);
186 
187  // Math Operators
190  friend PMPathPoint operator *(const PMReal& c, const PMPathPoint& pt);
193  friend PMPathPoint operator *(const PMPathPoint& pt, const PMReal& c);
196  friend PMPathPoint operator /(const PMPathPoint& numer, const PMReal& denom);
197 
198  // Assignment Operators
201  void operator *=(const PMReal& a);
204  void operator /=(const PMReal& a);
207  PMPathPoint(const PMPathPoint& rhs) noexcept = default;
208  PMPathPoint(PMPathPoint&& rhs) noexcept = default;
209  PMPathPoint& operator=(const PMPathPoint& rhs) noexcept = default;
210  PMPathPoint& operator=(PMPathPoint&& rhs) noexcept = default;
211 
212  // Comparison Operators
216  friend bool16 operator ==(const PMPathPoint& a, const PMPathPoint& b) noexcept;
220  friend bool16 operator !=(const PMPathPoint& a, const PMPathPoint& b) noexcept;
221 
222 private:
223  PMPathPointType fAnchorType;
224  PMPoint fLeftDirPt;
225  PMPoint fAnchorPt;
226  PMPoint fRightDirPt;
227 };
228 
229 inline bool16 operator ==(const PMPathPoint& a, const PMPathPoint& b) noexcept
230 {
231  return ( a.fAnchorType == b.fAnchorType &&
232  a.fLeftDirPt == b.fLeftDirPt &&
233  a.fAnchorPt == b.fAnchorPt &&
234  a.fRightDirPt == b.fRightDirPt );
235 }
236 
237 inline bool16 operator !=(const PMPathPoint& a, const PMPathPoint& b) noexcept
238 {
239  return !(a == b);
240 }
241 
242 
243 
244 #endif