1 #include "Annotation.h"
3 using namespace System;
4 using namespace System::Collections::Generic;
5 using namespace System::Text;
6 using namespace System::Drawing;
7 using namespace System::Drawing::Drawing2D;
32 [BrowsableAttribute(
false)]
35 bool get(){
return m_bClosed;}
36 void set(
bool bClosed)
49 if(Closed)
return __super::HitTest(pt);
52 System::Drawing::Rectangle rect(pt.X-3,pt.Y-3,7,7);
53 if(IntersectsRect(rect))
55 GraphicsPath^ gp = graphicsPath;
59 Inside = gp->IsOutlineVisible(pt,m_pen);
70 void addPoint(PointF pt);
76 virtual void Load(XmlElement^ element)
override;
83 virtual void Save(XmlDocument^ writer,XmlElement^ element)
override;
107 property Type AnnotationType
109 virtual Type
get()
override
111 return Annotations::Type::Pencil;
118 property Int16 PointsCount
120 virtual Int16
get()
override{
return 2;}
122 property array<RectangleF>^ PointRect
124 virtual array<RectangleF>^
get()
override
126 array<PointF>^ pts =
gcnew array<PointF>{m_ptArr[0],m_ptArr[m_ptArr->Length-1]};
127 array<RectangleF>^ rectArr =
gcnew array<RectangleF>(2);
128 for(
int i=0;i<pts->Length;i++)
130 rectArr[i] = RectangleF(pts[i].X-4,pts[i].Y-4,8,8);
139 property PointF Points[Int16]
141 virtual PointF
get(Int16 iIndex)
override
143 if(iIndex==0)
return m_ptArr[0];
144 else return m_ptArr[m_ptArr->Length-1];
146 virtual void set(Int16 iIndex,PointF Value)
override
148 PointF pt = Points[iIndex];
149 for(
int i=0;i<m_ptArr->Length;i++)
151 m_ptArr[i].X += Value.X -pt.X;
152 m_ptArr[i].Y += Value.Y -pt.Y;
156 virtual void Draw(GraphicsPath^ gp,array<PointF>^ ptArr)
override
180 property Type AnnotationType
182 virtual Type
get()
override
184 return Annotations::Type::Polyline;
191 [CategoryAttribute(
"General"), DescriptionAttribute(
"Color to fill in annotation. [Format: RGB/ARGB]")]
192 property Color FillColor
194 Color
get(){
return m_FillColor;}
195 void set(Color Value)
205 virtual void Draw(Graphics^ g,array<PointF>^ ptArr,
bool bShowSelection)
override
209 GraphicsPath^ gp =
gcnew GraphicsPath();
211 Brush^ brush =
gcnew SolidBrush(m_FillColor);
212 g->FillPath(brush,gp);
216 __super::Draw(g,ptArr,bShowSelection);
218 virtual void Draw(GraphicsPath^ gp,array<PointF>^ ptArr)
override
229 virtual void Load(XmlElement^ element)
override;
236 virtual void Save(XmlDocument^ writer,XmlElement^ element)
override;
256 m_bShowRulerMeasurement =
true;
261 property Type AnnotationType
263 virtual Type
get()
override
265 return Annotations::Type::PolyRuler;
268 [BrowsableAttribute(
false)]
269 property Color FillColor
271 Color
get(){
return Color::Black;}
274 property bool TickMarks
276 bool get(){
return m_bShowTick;}
277 void set(
bool value){m_bShowTick=value;}
280 property bool RulerMeasurement
282 bool get(){
return m_bShowRulerMeasurement;}
283 void set(
bool value){m_bShowRulerMeasurement=value;}
286 virtual void Draw(GraphicsPath^ gp,array<PointF>^ ptArr)
override
288 __super::Draw(gp,ptArr);
291 Graphics^ g = Graphics::FromHwnd(IntPtr(0));
292 float cx = 2.54/g->DpiX;
293 float cy = 2.54/g->DpiY;
295 array<PointF>^ normalPts = GetNormalPoints();
297 for(
int i=0;i<ptArr->Length-1;i++)
299 DrawScale(gp,ptArr[i],ptArr[i+1],getdistance(normalPts[i],normalPts[i+1],cx,cy));
307 virtual void Load(XmlElement^ element)
override;
314 virtual void Save(XmlDocument^ writer,XmlElement^ element)
override;
315 virtual void Draw(Graphics ^g,array<PointF>^ ptArr,
bool bShowSelection)
override;
317 void DrawMeasurement(Graphics^ g,PointF pt,array<PointF>^ ptArr);
320 bool m_bShowRulerMeasurement;
340 property Type AnnotationType
342 virtual Type
get()
override
344 return Annotations::Type::Curve;
350 [CategoryAttribute(
"General"), DescriptionAttribute(
"Color to fill in annotation. [Format: RGB/ARGB]")]
351 property Color FillColor
353 Color
get(){
return m_FillColor;}
354 void set(Color Value)
359 virtual void Draw(GraphicsPath^ gp,array<PointF>^ ptArr)
override
365 if(Closed)gp->AddClosedCurve(ptArr);
366 else gp->AddCurve(ptArr);
373 virtual void Draw(Graphics^ g,array<PointF>^ ptArr,
bool bShowSelection)
override;
379 virtual void Load(XmlElement^ element)
override;
386 virtual void Save(XmlDocument^ writer,XmlElement^ element)
override;
405 m_bShowRulerMeasurement =
true;
406 m_bShowAngleMeasurement =
true;
412 property Type AnnotationType
414 virtual Type
get()
override
416 return Annotations::Type::Angle;
420 property bool TickMarks
422 bool get(){
return m_bShowTick;}
423 void set(
bool value){m_bShowTick=value;}
426 property bool RulerMeasurement
428 bool get(){
return m_bShowRulerMeasurement;}
429 void set(
bool value){m_bShowRulerMeasurement=value;}
432 property bool AngleMeasurement
434 bool get(){
return m_bShowAngleMeasurement;}
435 void set(
bool value){m_bShowAngleMeasurement=value;}
438 virtual void Draw(GraphicsPath^ gp,array<PointF>^ ptArr)
override
440 gp->AddLine(ptArr[0],ptArr[1]);
443 gp->AddLine(ptArr[0],ptArr[2]);
446 Graphics^ g = Graphics::FromHwnd(IntPtr(0));
447 float cx = 2.54/g->DpiX;
448 float cy = 2.54/g->DpiY;
450 array<PointF>^ normalPts = GetNormalPoints();
452 if(m_bShowTick)DrawScale(gp,ptArr[1],ptArr[0],getdistance(normalPts[0],normalPts[1],cx,cy));
453 if(m_bShowTick && ptArr->Length>2)
454 DrawScale(gp,ptArr[0],ptArr[2],getdistance(normalPts[0],normalPts[2],cx,cy));
464 if(m_ptArr->Length==3)
466 array<PointF> ^ptArr =
gcnew array<PointF>(2);
467 ptArr[0] = m_ptArr[0];
468 ptArr[1] = m_ptArr[2];
469 return IsLineIntersectsRect(m_ptArr,rect)||IsLineIntersectsRect(ptArr,rect);
473 return IsLineIntersectsRect(m_ptArr,rect);
481 virtual void Load(XmlElement^ element)
override;
488 virtual void Save(XmlDocument^ writer,XmlElement^ element)
override;
493 virtual void Draw(Graphics^ g,array<PointF>^ ptArr,
bool bShowSelection)
override;
499 void AddArc(GraphicsPath^ path,array<PointF>^ ptArr);
508 static array<float>^ GetAngles(PointF pt0,PointF pt1,PointF pt2);
511 bool m_bShowRulerMeasurement;
512 bool m_bShowAngleMeasurement;
Pencil(Pen^ pen, MSTAnnotationPage^ page)
Constructor of a class.
Definition: MultiPointAnnotation.h:102
Definition: MultiPointAnnotation.h:245
Definition: MultiPointAnnotation.h:394
virtual bool IntersectsRect(System::Drawing::Rectangle rect) override
use to check annotation lies in rectangle or not.
Definition: MultiPointAnnotation.h:462
virtual bool HitTest(PointF pt) override
It is overrided function and use to check point lies in annotation or not.
Definition: MultiPointAnnotation.h:47
Definition: AnnotationPage.h:95
MultiPointAnnotation(Pen^ pen, MSTAnnotationPage^ page)
Constructor of a class.
Definition: MultiPointAnnotation.h:27
virtual void Draw(Graphics^ g, array< PointF >^ptArr, bool bShowSelection) override
Used to draw annotations.
Definition: MultiPointAnnotation.h:205
Definition: MultiPointAnnotation.h:19
PolyRuler(Pen^ pen, MSTAnnotationPage^ page)
Constructor of a class.
Definition: MultiPointAnnotation.h:253
PolyLine(Pen^ pen, MSTAnnotationPage^ page)
Constructor of a class.
Definition: MultiPointAnnotation.h:174
bool m_bClosed
Used to closed multipoint annotation i.e. if this is true then annotations starting and ending point ...
Definition: MultiPointAnnotation.h:87
Definition: MultiPointAnnotation.h:166
Definition: MultiPointAnnotation.h:94
Curve(Pen^ pen, MSTAnnotationPage^ page)
Constructor of a class.
Definition: MultiPointAnnotation.h:335
Definition: MultiPointAnnotation.h:327
Definition: Annotation.h:45