1 /* VPolyLine.h
2  * Object of connected lines, either open or closed
3  *
4  * Copyright (C) 2001-2010 by vhf interservice GmbH
5  * Author:   Ilonka Fleischmann
6  *
7  * created:  2001-07-31
8  * modified: 2008-10-11
9  *
10  * This program is free software; you can redistribute it and/or
11  * modify it under the terms of the vhf Public License as
12  * published by vhf interservice GmbH. Among other things, the
13  * License requires that the copyright notices and this notice
14  * be preserved on all copies.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19  * See the vhf Public License for more details.
20  *
21  * You should have received a copy of the vhf Public License along
22  * with this program; see the file LICENSE. If not, write to vhf.
23  *
24  * vhf interservice GmbH, Im Marxle 3, 72119 Altingen, Germany
25  * eMail: info@vhf.de
26  * http://www.vhf.de
27  */
28 
29 #ifndef VHF_H_VPOLYLINE
30 #define VHF_H_VPOLYLINE
31 
32 #include "VGraphic.h"
33 #include "VPath.h"
34 
35 @interface VPolyLine:VGraphic
36 {
37     int             maxcount;
38     int             count;
39     NSMutableData   *ptsData;
40     NSPoint         *ptslist;       // the vertices of the line
41     int             selectedKnob;   // index of the selected knob (0 - 3 or -1)
42     int             filled;
43     NSColor         *fillColor;     // fillColor if we are filled
44     NSColor         *endColor;      // endColor if we are graduated/radial filled
45     float           graduateAngle;  // angle of graduate filling
46     float           stepWidth;      // stepWidth the color will change by graduate/radial filling
47     NSPoint         radialCenter;   // the center position for radial filling in percent to the bounds
48     NSMutableArray  *graduateList;  // list holding the graduate filling graphic objects
49     BOOL            graduateDirty;  // if we must update the graduateList (calculate the graduate filling new)
50     NSRect          coordBounds;    // our coord bounding box
51 }
52 
53 /* class methods */
54 + (VPolyLine*)polyLine;
55 
56 /* line methods */
57 - (int)ptsCount;
58 - (void)setFilled:(BOOL)flag;
59 - (BOOL)filled;
60 - (NSColor*)fillColor;
61 - (void)setFillColor:(NSColor*)col;
62 - (NSColor*)endColor;
63 - (void)setEndColor:(NSColor*)col;
64 - (float)graduateAngle;
65 - (void)setGraduateAngle:(float)a;
66 - (void)setStepWidth:(float)sw;
67 - (float)stepWidth;
68 - (void)setRadialCenter:(NSPoint)rc;
69 - (NSPoint)radialCenter;
70 - (BOOL)closed; // whether PolyLine is closed (end point fits start point)
71 - (NSPoint)nearestPointInPtlist:(int*)pt_num distance:(float*)distance toPoint:(NSPoint)pt;
72 - (void)addPoint:(NSPoint)p;
73 - (VGraphic*)addPointAt:(NSPoint)pt;
74 - (void)addPoint:(NSPoint)pt atNum:(int)pt_num;
75 - (BOOL)removePoint:(NSPoint)pt;
76 - (BOOL)removePointWithNum:(int)pt_num;
77 - (void)truncate;
78 - (void)getEndPoints:(NSPoint*)p1 :(NSPoint*)p2;
79 - (float)length;
80 - (void)setDirectionCCW:(BOOL)ccw;
81 - (void)changeDirection;
82 - (void)changePoint:(int)pt_num :(NSPoint)pt;
83 - (NSPoint)gradientAt:(float)t;
84 - (BOOL)isPointInside:(NSPoint)p;
85 - (int)isPointInsideOrOn:(NSPoint)p;
86 - (int)selectedKnobIndex;
87 - (NSPoint)appendToBezierPath:(NSBezierPath*)bPath currentPoint:(NSPoint)currentPoint;
88 - (id)contour:(float)w inlay:(BOOL)inlay splitCurves:(BOOL)splitCurves;
89 - (void)join:obj;
90 - (VPath*)pathRepresentation;
91 - (int)intersections:(NSPoint**)pArray withRect:(NSRect)rect;
92 
93 @end
94 
95 #endif // VHF_H_VPOLYLINE
96