1 
  2 
  3 function figure_Page(x,y)
  4 {
  5 
  6     var r = new Polygon();
  7     r.addPoint(new Point(x, y));
  8     r.addPoint(new Point(x + figure_defaultFigureSegmentShortSize + 4 - figure_defaultFigureCorner, y));
  9     r.addPoint(new Point(x + figure_defaultFigureSegmentShortSize + 4, y + figure_defaultFigureCorner));
 10     r.addPoint(new Point(x + figure_defaultFigureSegmentShortSize + 4, y + figure_defaultFigureSegmentSize));
 11     r.addPoint(new Point(x, y + figure_defaultFigureSegmentSize));
 12 
 13     var f=new Figure("Page");
 14     f.style.fillStyle = figure_defaultFillStyle;
 15     f.style.strokeStyle = figure_defaultStrokeStyle;
 16 
 17     f.properties.push(new BuilderProperty('Text', 'primitives.1.str', BuilderProperty.TYPE_TEXT));
 18     f.properties.push(new BuilderProperty('Text Size ', 'primitives.1.size', BuilderProperty.TYPE_TEXT_FONT_SIZE));
 19     f.properties.push(new BuilderProperty('Font ', 'primitives.1.font', BuilderProperty.TYPE_TEXT_FONT_FAMILY));
 20     f.properties.push(new BuilderProperty('Alignment ', 'primitives.1.align', BuilderProperty.TYPE_TEXT_FONT_ALIGNMENT));
 21     f.properties.push(new BuilderProperty('Text Color', 'primitives.1.style.fillStyle', BuilderProperty.TYPE_COLOR));
 22 
 23     f.properties.push(new BuilderProperty(BuilderProperty.SEPARATOR));
 24     f.properties.push(new BuilderProperty('Stroke Style', 'style.strokeStyle', BuilderProperty.TYPE_COLOR));
 25     f.properties.push(new BuilderProperty('Fill Style', 'style.fillStyle', BuilderProperty.TYPE_COLOR));
 26     f.properties.push(new BuilderProperty('Line Width', 'style.lineWidth',BuilderProperty.TYPE_LINE_WIDTH));
 27 //f.properties.push(new BuilderProperty('Vertical Alignment ', 'primitives.1.valign', Text.VALIGNMENTS);
 28 
 29     f.addPrimitive(r);
 30 
 31     var t2 = new Text(figure_defaultFigureTextStr, x + figure_defaultFigureSegmentShortSize/2 + 2, y + figure_defaultFigureSegmentSize/2, figure_defaultFigureTextFont, figure_defaultFigureTextSize);
 32     t2.style.fillStyle = figure_defaultFillTextStyle;
 33 
 34     f.addPrimitive(t2);
 35 
 36     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x, y),ConnectionPoint.TYPE_FIGURE);
 37     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x + figure_defaultFigureSegmentShortSize / 2 + 2, y), ConnectionPoint.TYPE_FIGURE);
 38     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x + figure_defaultFigureSegmentShortSize + 4, y + figure_defaultFigureSegmentSize/2), ConnectionPoint.TYPE_FIGURE);
 39     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x + figure_defaultFigureSegmentShortSize + 4, y + figure_defaultFigureSegmentSize), ConnectionPoint.TYPE_FIGURE);
 40     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x + figure_defaultFigureSegmentShortSize / 2 + 2, y + figure_defaultFigureSegmentSize), ConnectionPoint.TYPE_FIGURE);
 41     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x, y + figure_defaultFigureSegmentSize), ConnectionPoint.TYPE_FIGURE);
 42     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x, y + figure_defaultFigureSegmentSize/2), ConnectionPoint.TYPE_FIGURE);
 43     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x + figure_defaultFigureSegmentShortSize / 2 + 2, y + figure_defaultFigureSegmentSize/2), ConnectionPoint.TYPE_FIGURE);
 44     f.finalise();
 45     return f;
 46 }
 47 
 48 function figure_PageUpperCornerFolded(x,y)
 49 {
 50     var r = new Polygon();
 51     r.addPoint(new Point(x + figure_defaultFigureSegmentShortSize + 4 - figure_defaultFigureCorner, y));
 52     r.addPoint(new Point(x, y));//tl
 53     r.addPoint(new Point(x, y + figure_defaultFigureSegmentSize));//bl
 54     r.addPoint(new Point(x + figure_defaultFigureSegmentShortSize + 4, y + figure_defaultFigureSegmentSize));//br
 55     r.addPoint(new Point(x + figure_defaultFigureSegmentShortSize + 4, y + figure_defaultFigureCorner));//tl
 56     r.addPoint(new Point(x + figure_defaultFigureSegmentShortSize + 4 - figure_defaultFigureCorner, y + figure_defaultFigureCorner));
 57     r.addPoint(new Point(x + figure_defaultFigureSegmentShortSize + 4 - figure_defaultFigureCorner, y+1));
 58     
 59     var l = new Line(new Point(x + figure_defaultFigureSegmentShortSize + 4, y + figure_defaultFigureCorner),new Point(x + figure_defaultFigureSegmentShortSize + 4 - figure_defaultFigureCorner, y))
 60     var f=new Figure("PageUpperCornerFolded");
 61     f.addPrimitive(l);
 62     f.style.fillStyle = figure_defaultFillStyle;
 63     f.style.strokeStyle = figure_defaultStrokeStyle;
 64     f.style.lineCap = f.style.STYLE_LINE_CAP_ROUND;
 65     
 66     f.properties.push(new BuilderProperty('Text', 'primitives.2.str', BuilderProperty.TYPE_TEXT));
 67     f.properties.push(new BuilderProperty('Text Size ', 'primitives.2.size', BuilderProperty.TYPE_TEXT_FONT_SIZE));
 68     f.properties.push(new BuilderProperty('Font ', 'primitives.2.font', BuilderProperty.TYPE_TEXT_FONT_FAMILY));
 69     f.properties.push(new BuilderProperty('Alignment ', 'primitives.2.align', BuilderProperty.TYPE_TEXT_FONT_ALIGNMENT));
 70     f.properties.push(new BuilderProperty('Text Color', 'primitives.2.style.fillStyle', BuilderProperty.TYPE_COLOR));
 71 
 72     f.properties.push(new BuilderProperty(BuilderProperty.SEPARATOR));
 73     f.properties.push(new BuilderProperty('Stroke Style', 'style.strokeStyle', BuilderProperty.TYPE_COLOR));
 74     f.properties.push(new BuilderProperty('Fill Style', 'style.fillStyle', BuilderProperty.TYPE_COLOR));
 75     f.properties.push(new BuilderProperty('Line Width', 'style.lineWidth',BuilderProperty.TYPE_LINE_WIDTH));
 76 //f.properties.push(new BuilderProperty('Vertical Alignment ', 'primitives.1.valign', Text.VALIGNMENTS);
 77 
 78     f.addPrimitive(r);
 79 
 80     var t2 = new Text(figure_defaultFigureTextStr, x + figure_defaultFigureSegmentShortSize/2 + 2, y + figure_defaultFigureSegmentSize/2, figure_defaultFigureTextFont, figure_defaultFigureTextSize);
 81     t2.style.fillStyle = figure_defaultFillTextStyle;
 82 
 83     f.addPrimitive(t2);
 84 
 85     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x, y),ConnectionPoint.TYPE_FIGURE);
 86     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x + figure_defaultFigureSegmentShortSize/2 + 2, y), ConnectionPoint.TYPE_FIGURE);
 87     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x + figure_defaultFigureSegmentShortSize + 4, y + figure_defaultFigureSegmentSize/2), ConnectionPoint.TYPE_FIGURE);
 88     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x + figure_defaultFigureSegmentShortSize + 2, y + figure_defaultFigureSegmentSize), ConnectionPoint.TYPE_FIGURE);
 89     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x + figure_defaultFigureSegmentShortSize/2 + 2, y + figure_defaultFigureSegmentSize), ConnectionPoint.TYPE_FIGURE);
 90     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x, y + figure_defaultFigureSegmentSize), ConnectionPoint.TYPE_FIGURE);
 91     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x, y + figure_defaultFigureSegmentSize/2), ConnectionPoint.TYPE_FIGURE);
 92     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x + figure_defaultFigureSegmentShortSize/2 + 2, y + figure_defaultFigureSegmentSize/2), ConnectionPoint.TYPE_FIGURE);
 93     f.finalise();
 94     return f;
 95 }
 96 
 97 function figure_PageLowerCornerFolded(x,y)
 98 {
 99 
100     var r = new Polygon();
101     r.addPoint(new Point(x + figure_defaultFigureSegmentShortSize + 4, y));
102     r.addPoint(new Point(x, y));
103     r.addPoint(new Point(x, y + figure_defaultFigureSegmentSize));
104 
105     r.addPoint(new Point(x + figure_defaultFigureSegmentShortSize - figure_defaultFigureCorner + 4, y + figure_defaultFigureSegmentSize));
106     //r.addPoint(new Point(x + figure_defaultFigureSegmentShortSize + 4, y + figure_defaultFigureSegmentSize - figure_defaultFigureCorner));
107     r.addPoint(new Point(x + figure_defaultFigureSegmentShortSize - figure_defaultFigureCorner + 4, y + figure_defaultFigureSegmentSize - figure_defaultFigureCorner));
108     r.addPoint(new Point(x + figure_defaultFigureSegmentShortSize + 4, y + figure_defaultFigureSegmentSize - figure_defaultFigureCorner));
109     r.addPoint(new Point(x + figure_defaultFigureSegmentShortSize + 4, y + figure_defaultFigureSegmentSize - figure_defaultFigureCorner));
110 
111     var l = new Line(new Point(x + figure_defaultFigureSegmentShortSize - figure_defaultFigureCorner + 4, y + figure_defaultFigureSegmentSize),new Point(x + figure_defaultFigureSegmentShortSize + 4, y + figure_defaultFigureSegmentSize - figure_defaultFigureCorner))
112     var f=new Figure("PageUpperCornerFolded");
113     f.style.fillStyle = figure_defaultFillStyle;
114     f.style.strokeStyle = figure_defaultStrokeStyle;
115 
116     f.addPrimitive(l);
117     f.properties.push(new BuilderProperty('Text', 'primitives.2.str', BuilderProperty.TYPE_TEXT));
118     f.properties.push(new BuilderProperty('Text Size ', 'primitives.2.size', BuilderProperty.TYPE_TEXT_FONT_SIZE));
119     f.properties.push(new BuilderProperty('Font ', 'primitives.2.font', BuilderProperty.TYPE_TEXT_FONT_FAMILY));
120     f.properties.push(new BuilderProperty('Alignment ', 'primitives.2.align', BuilderProperty.TYPE_TEXT_FONT_ALIGNMENT));
121     f.properties.push(new BuilderProperty('Text Color', 'primitives.2.style.fillStyle', BuilderProperty.TYPE_COLOR));
122 
123     f.properties.push(new BuilderProperty(BuilderProperty.SEPARATOR));
124     f.properties.push(new BuilderProperty('Stroke Style', 'style.strokeStyle', BuilderProperty.TYPE_COLOR));
125     f.properties.push(new BuilderProperty('Fill Style', 'style.fillStyle', BuilderProperty.TYPE_COLOR));
126     f.properties.push(new BuilderProperty('Line Width', 'style.lineWidth',BuilderProperty.TYPE_LINE_WIDTH));
127 //f.properties.push(new BuilderProperty('Vertical Alignment ', 'primitives.1.valign', Text.VALIGNMENTS);
128 
129     f.addPrimitive(r);
130 
131     var t2 = new Text(figure_defaultFigureTextStr, x + figure_defaultFigureSegmentShortSize / 2 + 2, y + figure_defaultFigureSegmentSize/2, figure_defaultFigureTextFont, figure_defaultFigureTextSize);
132     t2.style.fillStyle = figure_defaultFillTextStyle;
133 
134     f.addPrimitive(t2);
135 
136     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x, y),ConnectionPoint.TYPE_FIGURE);
137     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x + figure_defaultFigureSegmentShortSize / 2 + 2, y), ConnectionPoint.TYPE_FIGURE);
138     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x + figure_defaultFigureSegmentShortSize + 4, y + figure_defaultFigureSegmentSize/2), ConnectionPoint.TYPE_FIGURE);
139     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x + figure_defaultFigureSegmentShortSize + 4, y), ConnectionPoint.TYPE_FIGURE);
140     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x + figure_defaultFigureSegmentShortSize / 2 + 2, y + figure_defaultFigureSegmentSize), ConnectionPoint.TYPE_FIGURE);
141     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x, y + figure_defaultFigureSegmentSize), ConnectionPoint.TYPE_FIGURE);
142     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x, y + figure_defaultFigureSegmentSize/2), ConnectionPoint.TYPE_FIGURE);
143     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x + figure_defaultFigureSegmentShortSize / 2 + 2, y), ConnectionPoint.TYPE_FIGURE);
144     f.finalise();
145     return f;
146 }
147 
148 function figure_SemiCircleUp(x,y)
149 {
150 
151     var f = new Figure("SemiCircleUp");
152     f.style.fillStyle = figure_defaultFillStyle;
153     f.style.strokeStyle = figure_defaultStrokeStyle;
154 
155     f.properties.push(new BuilderProperty('Text', 'primitives.2.str', BuilderProperty.TYPE_TEXT));
156     f.properties.push(new BuilderProperty('Text Size ', 'primitives.2.size', BuilderProperty.TYPE_TEXT_FONT_SIZE));
157     f.properties.push(new BuilderProperty('Font ', 'primitives.2.font', BuilderProperty.TYPE_TEXT_FONT_FAMILY));
158     f.properties.push(new BuilderProperty('Alignment ', 'primitives.2.align', BuilderProperty.TYPE_TEXT_FONT_ALIGNMENT));
159     f.properties.push(new BuilderProperty('Text Color', 'primitives.2.style.fillStyle', BuilderProperty.TYPE_COLOR));
160 
161     f.properties.push(new BuilderProperty(BuilderProperty.SEPARATOR));
162     f.properties.push(new BuilderProperty('Stroke Style', 'style.strokeStyle', BuilderProperty.TYPE_COLOR));
163     f.properties.push(new BuilderProperty('Fill Style', 'style.fillStyle', BuilderProperty.TYPE_COLOR));
164     f.properties.push(new BuilderProperty('Line Width', 'style.lineWidth',BuilderProperty.TYPE_LINE_WIDTH));
165 //f.properties.push(new BuilderProperty('Vertical Alignment ', 'primitives.2.valign', Text.VALIGNMENTS);
166 
167 
168     var c = new Arc(x, y, figure_defaultFigureRadiusSize, 180, 360, false, 0);
169     var l = new Line(new Point(x - figure_defaultFigureRadiusSize, y), new Point(x + figure_defaultFigureRadiusSize, y) );
170     f.addPrimitive(c);
171     f.addPrimitive(l);
172     var t2 = new Text(figure_defaultFigureTextStr, x, y - figure_defaultFigureRadiusSize/2, figure_defaultFigureTextFont, figure_defaultFigureTextSize);
173     t2.style.fillStyle = figure_defaultFillTextStyle;
174 
175     f.addPrimitive(t2);
176 
177     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x + figure_defaultFigureRadiusSize, y), ConnectionPoint.TYPE_FIGURE);
178     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x - figure_defaultFigureRadiusSize, y), ConnectionPoint.TYPE_FIGURE);
179     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x, y - figure_defaultFigureRadiusSize), ConnectionPoint.TYPE_FIGURE);
180     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x, y), ConnectionPoint.TYPE_FIGURE);
181     f.finalise();
182     return f;
183 }
184 
185 function figure_SemiCircleDown(x,y)
186 {
187 
188     var f = new Figure("SemiCircleDown");
189     f.style.fillStyle = figure_defaultFillStyle;
190     f.style.strokeStyle = figure_defaultStrokeStyle;
191 
192     f.properties.push(new BuilderProperty('Text', 'primitives.2.str', BuilderProperty.TYPE_TEXT));
193     f.properties.push(new BuilderProperty('Text Size ', 'primitives.2.size', BuilderProperty.TYPE_TEXT_FONT_SIZE));
194     f.properties.push(new BuilderProperty('Font ', 'primitives.2.font', BuilderProperty.TYPE_TEXT_FONT_FAMILY));
195     f.properties.push(new BuilderProperty('Alignment ', 'primitives.2.align', BuilderProperty.TYPE_TEXT_FONT_ALIGNMENT));
196     f.properties.push(new BuilderProperty('Text Color', 'primitives.2.style.fillStyle', BuilderProperty.TYPE_COLOR));
197 
198     f.properties.push(new BuilderProperty(BuilderProperty.SEPARATOR));
199     f.properties.push(new BuilderProperty('Stroke Style', 'style.strokeStyle', BuilderProperty.TYPE_COLOR));
200     f.properties.push(new BuilderProperty('Fill Style', 'style.fillStyle', BuilderProperty.TYPE_COLOR));
201     f.properties.push(new BuilderProperty('Line Width', 'style.lineWidth',BuilderProperty.TYPE_LINE_WIDTH));
202  //f.properties.push(new BuilderProperty('Vertical Alignment ', 'primitives.2.valign', Text.VALIGNMENTS);
203 
204 
205     var c = new Arc(x, y, figure_defaultFigureRadiusSize, 0, 180, false, 0);
206     var l = new Line(new Point(x - figure_defaultFigureRadiusSize, y), new Point(x + figure_defaultFigureRadiusSize, y) );
207     f.addPrimitive(c);
208     f.addPrimitive(l);
209     var t2 = new Text(figure_defaultFigureTextStr, x, y + figure_defaultFigureRadiusSize/2, figure_defaultFigureTextFont, figure_defaultFigureTextSize);
210     t2.style.fillStyle = figure_defaultFillTextStyle;
211 
212     f.addPrimitive(t2);
213 
214     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x + figure_defaultFigureRadiusSize, y), ConnectionPoint.TYPE_FIGURE);
215     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x - figure_defaultFigureRadiusSize, y), ConnectionPoint.TYPE_FIGURE);
216     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x, y + figure_defaultFigureRadiusSize), ConnectionPoint.TYPE_FIGURE);
217     CONNECTOR_MANAGER.connectionPointCreate(f.id, new Point(x, y), ConnectionPoint.TYPE_FIGURE);
218     f.finalise();
219     return f;
220 }
221 
222 function figure_Triangle(x,y)
223 {
224 
225     var t = new Polygon();
226     t.addPoint(new Point(x + figure_defaultFigureSegmentSize/2, y));
227     t.addPoint(new Point(x + figure_defaultFigureSegmentSize, y + figure_defaultFigureSegmentSize));
228     t.addPoint(new Point(x, y + figure_defaultFigureSegmentSize));
229 
230     var e = new Figure("Triangle");
231     e.style.fillStyle = figure_defaultFillStyle;
232     e.style.strokeStyle = figure_defaultStrokeStyle;
233     e.properties.push(new BuilderProperty('Text', 'primitives.1.str', BuilderProperty.TYPE_TEXT));
234     e.properties.push(new BuilderProperty('Text Size ', 'primitives.1.size', BuilderProperty.TYPE_TEXT_FONT_SIZE));
235     e.properties.push(new BuilderProperty('Font ', 'primitives.1.font', BuilderProperty.TYPE_TEXT_FONT_FAMILY));
236     e.properties.push(new BuilderProperty('Alignment ', 'primitives.1.align', BuilderProperty.TYPE_TEXT_FONT_ALIGNMENT));
237     e.properties.push(new BuilderProperty('Text Color', 'primitives.1.style.fillStyle', BuilderProperty.TYPE_COLOR));
238 
239     e.properties.push(new BuilderProperty(BuilderProperty.SEPARATOR));
240     e.properties.push(new BuilderProperty('Stroke Style', 'style.strokeStyle', BuilderProperty.TYPE_COLOR));
241     e.properties.push(new BuilderProperty('Fill Style', 'style.fillStyle', BuilderProperty.TYPE_COLOR));
242     e.properties.push(new BuilderProperty('Line Width', 'style.lineWidth',BuilderProperty.TYPE_LINE_WIDTH));
243 //
244     //f.properties.push(new BuilderProperty('Vertical Alignment ', 'primitives.1.valign', Text.VALIGNMENTS);
245 
246     var t2 = new Text(figure_defaultFigureTextStr, x + figure_defaultFigureSegmentSize/2, y + figure_defaultFigureSegmentSize/2 + 7, figure_defaultFigureTextFont, figure_defaultFigureTextSize);
247     t2.style.fillStyle = figure_defaultFillTextStyle;
248 
249     e.addPrimitive(t);
250     e.addPrimitive(t2);
251     CONNECTOR_MANAGER.connectionPointCreate(e.id,new Point(x + figure_defaultFigureSegmentSize/2, y), ConnectionPoint.TYPE_FIGURE);
252     CONNECTOR_MANAGER.connectionPointCreate(e.id,new Point(x + figure_defaultFigureSegmentSize, y + figure_defaultFigureSegmentSize), ConnectionPoint.TYPE_FIGURE);
253     CONNECTOR_MANAGER.connectionPointCreate(e.id,new Point(x, y + figure_defaultFigureSegmentSize), ConnectionPoint.TYPE_FIGURE);
254     CONNECTOR_MANAGER.connectionPointCreate(e.id,new Point(x + figure_defaultFigureSegmentSize/2, y + figure_defaultFigureSegmentSize), ConnectionPoint.TYPE_FIGURE);
255     CONNECTOR_MANAGER.connectionPointCreate(e.id,new Point(x + figure_defaultFigureSegmentSize/2, y + figure_defaultFigureSegmentSize/2+5), ConnectionPoint.TYPE_FIGURE);
256     CONNECTOR_MANAGER.connectionPointCreate(e.id,new Point(x + figure_defaultFigureSegmentSize/2 + figure_defaultFigureSegmentSize/4, y + figure_defaultFigureSegmentSize/2), ConnectionPoint.TYPE_FIGURE);
257     CONNECTOR_MANAGER.connectionPointCreate(e.id,new Point(x + figure_defaultFigureSegmentSize/4, y + figure_defaultFigureSegmentSize/2), ConnectionPoint.TYPE_FIGURE);
258 
259     e.finalise();
260     return e;
261 }