Subversion Repositories general

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
240 swalkenh 1
PK
746 swalkenh 2
 
3
}÷.	META-INF/þÊPK
4
 
5
}÷.ñÍSºMMMETA-INF/MANIFEST.MFManifest-Version: 1.0
240 swalkenh 6
Comment: you can set named regions on pictures
7
Transform-To-File: src/plugins/regionEditorPlugin/RegionEditorPluginTr
8
 ansform.xsl
9
Created-By: 1.4.0 (Sun Microsystems Inc.)
10
Description: ...(todo)
11
XMLEditor-Plugin-Name: RegionEditor
12
Class-Path: ImagePlugin.jar
13
Transform-Fro-File: src/plugins/regionEditorPlugin/RegionEditorPluginT
260 swalkenh 14
 ransformBack.xsl
240 swalkenh 15
Main-Class: src.plugins.regionEditorPlugin.RegionEditorPlugin
16
 
17
Name: src/plugins/regionEditorPlugin
18
Specification-Version: 0.4 (05/07/03)
19
Specification-Title: plugin for XMLEditor
20
Implementation-Version: 0.1 (05/07/03)
21
Implementation-Title: src.plugins.regionEditorPlugin
22
Implementation-Vendor: group5, software practice SS_2003, University B
23
 ielefeld, Germany
24
Specification-Vendor: group5, software practice SS_2003, University Bi
25
 elefeld, Germany
26
 
27
PK
746 swalkenh 28
 
29
imageWidthimageHeightcoefDregionsLjava/util/List;selectedRegion'Lsrc/plugins/regionEditorPlugin/Region;<init>(Ljava/util/List;)VCode(Z)V
30
 
31
 
32
 
33
*-java/awt/Graphics/setColor(Ljava/awt/Color;)V12
34
 
35
 
36
 
37
 
38
 
39
 
40
 
41
 
42
 
43
injava/awt/RectanglepgetX()Drs
44
 
45
 
46
 
47
 
48
 
49
 
50
 
51
 
52
Cº
~*¶%=*¶(>+*¶.¶4+¶8*´:Æ_*´:¶?6*´:¶A6‡‡o9‡‡o9*¸GµI*´I˜œ*µI§‡*´IoŽ6‡*´IoŽ6*dlµK*dlµM*µO*µQ+*´:*´K*´M¶UW+²[¶4+²^¶a6
53
§`*´
54
 
55
 
56
 
57
 
58
¶u*´IoŽ*´K`
59
¶x*´IoŽ*´M`
60
¶z*´IoŽ
61
¶|*´IoŽ¶±ª*KL
62
OPS!V+W5X=YE[P]Y^a`lawde‹f‘g—j­m´n»oÁpÑrÚsáuâvòwx
yuo,~3<€CD‚Tƒd„o…z}ˆz~~†‡yˆ
63
t‰+RŠ5H‹=@Œ
E8
¾nŽ
64
ÑJá:‘<A‘
65
’“F
66
*+µ:*¶—±‘	’
67
 
68
 
69
ÁŸ PK
70
 
71
 
72
 
73
 
74
 * University of Bielefeld, Germany
75
 
76
 
77
 
78
 
79
 * $Id: ImagePanel.java,v 1.4 2003/07/23 11:58:09 ioklasse Exp $
80
 */
81
82
package src.plugins.regionEditorPlugin;
83
84
import java.util.List;
85
86
import java.awt.Color;
87
import java.awt.Rectangle;
88
import java.awt.Graphics;
89
 
90
91
 
92
93
 
94
 * Image panel shows any image.
95
 *
96
 * @author Yulia Klassen
97
 * @author Viktoriya Zudova
98
 
99
 * @version $Revision: 1.4 $ Last modification: $Date: 2003/07/23 11:58:09 $
100
 
101
class ImagePanel extends JPanel {
102
103
	/* The current image. */
104
	private Image image;
105
106
	/* The dx-shift of an image in relation to the left top corner of plugin panel. */
107
	private int dx;
108
109
	/* The dy-shift of an image in realtion to the left top corner of plugin panel. */
110
 
111
112
	/* The width of the image. */
113
 
114
115
	/* The height of the image. */
116
 
117
118
	/* The scale coef of the image. */
119
 
120
	
121
	/* The list of all regions. */
122
 
123
	
124
	/* The selected region. */
125
 
126
127
	/**
128
 
129
	 * all elements for the options dialog.
130
	 *
131
 
132
	 */
133
	public ImagePanel(List regions) {
134
 
135
		this.regions = regions;
136
	}
137
138
	/**
139
	 * <code>paintComponent</code> draws the image.
140
	 *
141
	 * @see javax.swing.JComponent#paintComponent
142
	 */
143
	public void paintComponent(Graphics g) {
144
		int w  = getWidth();
145
 
146
147
		/* Fill the background. */
148
		g.setColor(getBackground());
149
		g.fillRect(0, 0, w, h);
150
151
		/* If there is an image ... */
152
		if(image != null) {
153
154
 
155
	  		int iw = image.getWidth(null);
156
	  		int ih = image.getHeight(null);
157
	  		double kx = (double)iw/w;
158
 
159
160
	 		coef = Math.max(kx, ky);
161
 
162
      	  	if(coef < 1) {
163
      			coef = 1;
164
      	  	} else {
165
      			iw = (int)(iw/coef);
166
      			ih = (int)(ih/coef);
167
 
168
169
 
170
      	  	dy = (h-ih)/2;
171
      	  	imageWidth = iw;
172
      	  	imageHeight = ih;
173
174
      	  	/* Draw the image. */
175
      	  	g.drawImage(image, dx, dy, iw, ih, null);
176
 
177
      	  	/* Draw regions. */
178
      	  	g.setColor(Color.black);
179
      	  	g.setXORMode(Color.white);
180
      	  	for(int i = 0; i < regions.size(); i++) {
181
 
182
183
      			if(region != selectedRegion){// the selected one will be drawn later
184
 
185
186
      				g.drawRect(
187
        				(int)(rect.getX() / coef) + dx,
188
        				(int)(rect.getY() / coef) + dy,
189
        				(int)(rect.getWidth() / coef),
190
 
191
      			}
192
	  		}
193
 
194
	  		/* Draw the selected rectangle. */
195
	  		if(selectedRegion != null) {
196
   			    Rectangle rect = selectedRegion.getRect();
197
				g.setColor(Color.red);
198
				g.drawRect(
199
    			  	(int)(rect.getX() / coef) + dx,
200
    			  	(int)(rect.getY() / coef) + dy,
201
 
202
    			  	(int)(rect.getHeight() / coef));
203
	  		}
204
		}
205
	}
206
207
  	/**
208
  	 * Sets the currently visible image to the image given as parameter.
209
  	 *
210
  	 * @param image: The image to display.
211
  	 */
212
  	public void setImage(Image image) {
213
		this.image = image;
214
 
215
	}
216
217
	// TODO comments
218
	public double getCoef() {
219
		return coef;
220
	}
221
222
  	/**
223
  	 * Returns the dx-shift of an image according to the left top
224
 
225
  	 *
226
  	 * @return The difference on the x-axis.
227
  	 */
228
	public int getDx() {
229
 
230
	}
231
232
    /**
233
     * Returns the dy-shift of an image according to the left top
234
     * corner of the plugin panel.
235
     *
236
     * @return The difference on the y-axis.
237
     */
238
	public int getDy() {
239
 
240
	}
241
242
    /**
243
     * Returns the width of the current image.
244
     *
245
     * @return The width of the current image.
246
     */
247
	public int getImageWidth() {
248
		return imageWidth;
249
 
250
251
	/**
252
	 * Returns the height of the current image.
253
	 *
254
	 * @return The height of the current image.
255
	 */
256
	public int getImageHeight() {
257
		return imageHeight;
258
 
259
260
	// TODO comments
261
	public void setSelectedRegion(Region region) {
262
		this.selectedRegion = region;
263
	}
264
}PK
265
{÷.h®‘¡ÂÂ+src/plugins/regionEditorPlugin/Region.classÊþº¾-!%src/plugins/regionEditorPlugin/Regionjava/lang/ObjectnameLjava/lang/String;rectLjava/awt/Rectangle;<init>()VCode	
266
267
 
268
SourceFileRegion.java!	
269
3*·
±
270
 "	Y*·
*+µ*,µ±%'	() /*´°.>*+µ±
271
45/*´°:>*+µ±
272
@A PK
273
 
274
 
275
 
276
 * Coded by: Group 5, software practice summer 2003
277
 
278
 *
279
 
280
 *
281
 
282
 
283
 
284
285
package src.plugins.regionEditorPlugin;
286
287
import java.awt.Rectangle;
288
//import org.w3c.dom.Node;
289
290
/**
291
 * Stores info of one region.
292
 *
293
 * @author Yulia Klassen, Viktoriya Zudova
294
 
295
public class Region
296
 
297
  /* stores name of region*/
298
  private String name;
299
 
300
  /* stores coordinates of region */
301
  private Rectangle rect;
302
303
  /* creates empty region with coordinates and name*/
304
  public Region()
305
  {
306
  }
307
308
  /* creates new region with coordinates and name*/
309
 
310
  {
311
	this.name = name;
312
 
313
  }
314
315
  /* returns the name of the region */
316
  public String getName()
317
 
318
	return name;
319
  }
320
321
  /* sets the name of the region */
322
  public void setName(String name)
323
  {
324
 
325
  }
326
327
  /* returns the coordinates of the region */
328
  public Rectangle getRect()
329
  {
330
 
331
  }
332
333
  /* sets the coordinates of the region */
334
  public void setRect(Rectangle rect)
335
  {
336
 
337
  }
338
}
339
PK
340
{÷.ŸÙæKI;I;7src/plugins/regionEditorPlugin/RegionEditorPlugin.classÊþº¾-½1src/plugins/regionEditorPlugin/RegionEditorPluginjavax/swing/JPanelsrc/plugins/PluginInterfacejava/awt/event/ActionListener"java/awt/event/MouseMotionListener	java/awt/event/MouseListener
341
pluginNameLjava/lang/String;
ConstantValueRegionEditorimageLjava/awt/Image;imageNameFieldLjavax/swing/JTextField;
confirmButtonLjavax/swing/JButton;regionNameFieldregionConfirmButton
342
 
343
moveCursorresizeCursorinMoveZinResizepopupLjavax/swing/JPopupMenu;deleteSelectedItemLjavax/swing/JMenuItem;<init>()VCode67
344
9
	;javax/swing/JTextField=
345
>9	@javax/swing/JButtonBConfirmD(Ljava/lang/String;)V6F
346
CG	I	K	Mjava/util/ArrayListO
347
P9'(	Rjava/awt/CursorT(I)V6V
348
UW+,	Y-,	[.,	]/0	_10	ajavax/swing/JPopupMenuc
349
d923	fjavax/swing/JMenuItemhDelete the regionj
350
 
521 swalkenh 351
p9java/awt/Containerr	setLayout(Ljava/awt/LayoutManager;)Vtu
746 swalkenh 352
sv)src/plugins/regionEditorPlugin/ImagePanelx(Ljava/util/List;)V6z
353
y{	}java/awt/ComponentaddMouseListener!(Ljava/awt/event/MouseListener;)V‚
354
€ƒaddMouseMotionListener'(Ljava/awt/event/MouseMotionListener;)V…†
355
€‡add*(Ljava/awt/Component;)Ljava/awt/Component;‰Š
356
 
357
 
358
 
359
 
360
 
361
 
362
 
363
 
364
 
365
 
366
 
367
 
368
 
369
 
370
 
371
 
372
 
373
 
374
 
375
setPluginPanel(Ljavax/swing/JPanel;)V½nodeenvironmentLorg/w3c/dom/Document;elementPathLjavax/swing/tree/TreePath;workingPathparentLsrc/parser/AdapterNode;getChild(I)Lsrc/parser/AdapterNode;)*
376
 
377
ò/
hasAttributes()Z12Ó3item(I)Lorg/w3c/dom/Node;56Ú7java/lang/String9equals(Ljava/lang/Object;)Z;<
378
:=toLowerCase?à
379
 
380
:F.gifH.pngJ	getLength()ILMÚN6
381
òP
382
 
383
 
384
 
385
 
386
 
387
 
388
‹’‰<b”java/lang/NumberFormatException–childrenLorg/w3c/dom/NodeList;rectNoderectChildrennamesubnodeattrsex!Ljava/lang/NumberFormatException;valuejava/lang/System¢outLjava/io/PrintStream;¤¥	£¦1=================================================¨java/io/PrintStreamªprintln¬F
389
«­ ¯print±F
390
 
391
 
392
 
393
 
394
ÙÝsrc/control/OurEventListenerß
firedOurEvent(Lsrc/control/OurEvent;)VáâàãeLsrc/control/OurEvent;sendRegionChanged*(Lsrc/plugins/regionEditorPlugin/Region;)Vregion"#	ê	ìNo imageîgetCurrentFile()Ljava/io/File;ðñ½òjava/io/Fileô
getParentFileöñ
395
õ÷
396
õ	
397
startsWithúE
398
 
399
:charAt(I)C
400
 
401
õG#(Ljava/io/File;Ljava/lang/String;)V6
402
õ	javax/imageio/ImageIOread.(Ljava/io/File;)Ljava/awt/image/BufferedImage;

403
Show image from Cannot open file setImage(Ljava/awt/Image;)V
404
yjava/io/IOExceptionfileNamedocLjava/io/IOException;actionPerformed(Ljava/awt/event/ActionEvent;)Vjava/util/EventObject 	getSource"î
405
!#getText%à
406
&Ê7
407
()*	*setName,F
408
‹-çè
409
/deleteRegion1è
410
2Ljava/awt/event/ActionEvent;mouseDragged(Ljava/awt/event/MouseEvent;)Vjava/awt/event/MouseEvent7getX9M
411
 
412
8=	showMouse?”
413
@getRect()Ljava/awt/Rectangle;BC
414
‹DgetDxFM
415
yGgetCoef()DIJ
416
yKgetDyMM
417
yNgetWidthPJ
418
Qjava/awt/ImageS!(Ljava/awt/image/ImageObserver;)IPU
419
TV	getHeightXJ
420
YXU
421
T[setLocation]”
422
^repaint`7
423
€a9J
424
c<J
425
 
426
hsetSelectedRegionjè
427
k	addRegionmè
428
 
429
mouseMoved
430
 
431
 
432
€{region1region2
getImageWidthM
433
y€getImageHeight‚M
434
 
435
†•mouseXmouseYxxyymouseClickedselectRegion”
436
 
437
 
438
 
439
£size¥Mb¦java/lang/Math¨abs(I)Iª«
440
©¬nordWest
currentRegion
441
setEnabled°©
442
i±show(Ljava/awt/Component;II)V³´
443
dµ
444
 
445
‹¹
446
SourceFileRegionEditorPlugin.java!
447

 !"#$%&%'()*+,-,.,/0102345678Ll*·:*µ<*»>Y·?µA*»CYE·HµJ*»>Y·?µL*»CYE·HµN*»PY·QµS*»UY·XµZ*»UY
·Xµ\*»UY·Xµ^*µ`*µb*»dY·eµg*»iYk·lµn*»pY·q¶w*»yY*´S·|µ~*´~*¶„*´~*¶ˆ»Y·:L+»pY·q¶w+*´A¶ŒW+*´JŽ¶‘»Y·:M,»“Yð·–¶œ,»pY·q¶w,*´L¶ŒW,*´NŽ¶‘»Y·:N-»pY·q¶w-+¶ŒW-,Ž¶‘*-ž¶‘**´~¶ŒW*´J*¶¤*´N*¶¤*´n*¶¤*´g*´n¶§W*¶«±¬ž'ŠE
448
 
449
 
450
¹*´A*´ä¶**´æ·*+·*´·*¹ *¶«±¬VÉÊË#Ì2Î8Ï<ÐRÓWÔ`ØjÙxÚÝ‹à’áÀæËçÓêØìâíçî­>讯è!%è"#è$%^Š&%j'(óô8ÅÝ66§Ì,¶,¶0:¹4™”¹×:6	§y	¹8:¹â+¶>™]6
451
§K
452
 
453
 
454

455
 
456
 
457
_2`8b
458
 
459
6§­¹l:¹os¶>™d¹×:

u¹Þ¹â¸{6
}¹Þ¹â¸{6
¹Þ¹â¸{6
¹Þ¹â¸{6	§3:§.¹oƒ¶>™¹â¶†:

ˆ¶>š
:
460
 
461
»Y	··“¹•W„,¹‰¡þç±pÃ׬n%	'()+.,7-:.=/@0C1F3L4W7g8p;„<˜=¬>Ã@ÈDØEäGó3K$(1N­¢2®¯2!%"˜™\]š%7í›™:êt]=ç|]@ä~]Cá€]	FÞœ
462
I¹^]Wœ%pXžZ
ÅŸ ä¡
ÎÏ8éš²§©¶®+¹oN+¹×:+¹i:6§²§°¶³„h¡ÿﲧ»üY-¸··ÿ¹¶¶
463
¶³ÆY6§G²§»üY°·ÿ¹8¹o¶»¶¹8¹â¶¶¶
464
¶³„¹O¡ÿ³+¹âÆ%²§»üY½·ÿ+¹â¶¿¶¶
465
¶³²§¶Á6§*¹l`·Ñ„¹‰¡ÿäš²§©¶®±¬^RS
UVW$Z>]X`]acbfb‡cžb¤a³g¼hÞiälêmúl	o
pq­\	®¯!%Â]œûžZ$óÙ'\]`S\]ç"\]Ä78m3*¶«*´·¹Á¹Æ*´·¹Á¹É*´·¹Á¹Í±¬{|}#~2­3®¯ÅÆ8>*+µȱ¬
466
 
467
 
468
 
469
¹É§RM*´·¹ú»üY·ÿ+¶¶
470
¹*´·¹Á¹Æ*´·¹Á»üY·ÿ+¶¶
471
 
472
 
473
‰
Ÿ¶àåæëï&.­z/®¯/åp4ŸqrJ‰tsar|sé qrÿŠtss|sk~s'b€s	Ÿts¶x|st68Ía+¶$*´~¦X*´íÆQ*+¶;+¶>¶A*+¶;+¶>·xM,Æ**´\¶|§(*+¶;+¶>·xN-Æ**´^¶|§**´Z¶|±¬*
474
 
475
 
476
rt]g|]T'Š]b‹]Œ68c#+¶$*´~¦*´íÆ*+¶;+¶>·*¶b±¬UVW"Y­#®¯#åp68ÿ+¶$*´~¦v*´íÆo+¶“™*+¶;+¶>·–§Y*+¶;+¶>·xM,Æ**´\¶|*,·l*µ`§2*+¶;+¶>·xN-Æ**´^¶|*-·l*µb§**´Z¶|±¬>bcd(g6i:jBkGlOo]qarisntvw~|­*®¯åp6H}*]!~*—68x0+¶$*´~¦'*´íÆ +¶“™*+¶;+¶>·–*µ`*µb±¬‡ˆ‰%Œ*/­0®¯0åp˜685±¬—­®¯åp™68W+¶$*´~¦*´·¹Á¹Í±¬¢£¥­®¯åpmè8L*´S+¹•W*¶b±¬®¯°­®¯é*1è8]*´++¦*·l*´S+¹œW*¶b±¬¹
º»¼­®¯é*”8÷m*´~¶Hd‡*´~¶LkŽ>*´~¶Od‡*´~¶LkŽ6*·l6§-*´S¹ À‹:¶E¶¤™*·l§„*´S¹§¡ÿ˱¬*
477
ÆÇ)É.Ë4ÌDÎRÏXÐ[ËlÓ­Hm®¯mt]m|]YŠ])D‹]1;\]Dé*uv8…
478
Á*´~¶Hd‡*´~¶LkŽ6*´~¶Od‡*´~¶LkŽ6:6§€*´S¹ À‹:¶E:	™-	¶dŽd¸­¢R	¶fŽd¸­¢B:§L§8	¶dŽ	¶RŽ`d¸­¢!	¶fŽ	¶ZŽ`d¸­¢
479
:§„*´S¹§¡ÿx°¬Fàá*ã-å3æCçJéNê^ënírîxòó¦õªö­å¾û­f
480
Á®¯Át]Á|]Á®0¬Š]*—‹]-”¯*0Ž\]Cjé*Jcqr	””8v(*·*¶b*´n*´+Ƨ¶²*´g*¶¶±¬
481

482
 
483
 
484
 
485
 
486
 * Coded by: Group 5, software practice summer 2003
487
 * University of Bielefeld, Germany
488
 *
489
 * @version $Revision: 1.22 $
490
 *
491
 * Last modification: $Date: 2003/07/23 12:40:18 $
492
 * $Id: RegionEditorPlugin.java,v 1.22 2003/07/23 12:40:18 mdonner Exp $
493
 */
494
495
package src.plugins.regionEditorPlugin;
496
497
 
498
 
499
 
500
import java.awt.BorderLayout;
501
import java.awt.Cursor;
502
import java.awt.Dimension;
503
import java.awt.Image;
504
import java.awt.Point;
505
 
506
507
import java.awt.event.ActionEvent;
508
import java.awt.event.ActionListener;
509
import java.awt.event.MouseEvent;
510
import java.awt.event.MouseListener;
511
 
512
513
import java.io.File;
514
 
515
516
 
517
import javax.swing.JPopupMenu;
518
 
519
 
520
import org.w3c.dom.NamedNodeMap;
521
 
522
import org.w3c.dom.Node;
523
 
524
import javax.swing.JButton;
525
 
521 swalkenh 526
//import javax.swing.JLabel;
746 swalkenh 527
import javax.swing.JPanel;
521 swalkenh 528
import javax.swing.JTextField;
529
import javax.swing.tree.TreePath;
530
746 swalkenh 531
532
import src.control.OurEvent;
533
import src.control.OurEventListener;
534
import src.gui.*;
521 swalkenh 535
import src.plugins.PluginInterface;
536
 
537
538
 
746 swalkenh 539
/**
540
 * The <code>RegionEditor</code> plugin shows and edits image regions.
541
 
521 swalkenh 542
 * @author Yulia Klassen, Viktoriya Zudova
746 swalkenh 543
 *
544
 * @version $Revision: 1.22 $ Last modification: $Date: 2003/07/23 12:40:18 $
545
 */
546
public class RegionEditorPlugin
547
  extends JPanel
521 swalkenh 548
 
746 swalkenh 549
{
550
  /** Name of the plugin, used in method <code>firePluginChangedElement</code> */
551
  final private String pluginName = "RegionEditor";
552
553
  /* The current image. */
521 swalkenh 554
 
746 swalkenh 555
556
  /* A text field to enter the name of an image. */
557
 
558
559
  /* A button "Confirm" to change the image name in the node. */
560
 
561
562
  /* A text field to enter the name of region. */
521 swalkenh 563
  private JTextField regionNameField = new JTextField();
564
565
 
746 swalkenh 566
  private JButton regionConfirmButton = new JButton("Confirm");
567
568
  /* An image panel to show an image in. */
569
  private ImagePanel imagePanel;
570
571
  /* Stores a reference to the GUI. */
572
 
573
 
521 swalkenh 574
  /* Stores a reference to the event listener. */
575
  private OurEventListener ourEventListener;
576
577
  /* the image's name from the attributes of the selected node */
746 swalkenh 578
  private String imageName;
521 swalkenh 579
 
746 swalkenh 580
 
521 swalkenh 581
  private String imageUrl;
746 swalkenh 582
583
  /* The current file. */
584
  private File currentFile;
585
586
  /* The node given from the basis program. */
521 swalkenh 587
  private Node oldNode;
746 swalkenh 588
589
  /* The node returned to the basis program. */
590
  private Node changedNode;
591
592
  /* The list of all regions. */
593
  private List regions = new ArrayList();
521 swalkenh 594
 
746 swalkenh 595
  /* The selected region. */
596
  private Region selectedRegion;
521 swalkenh 597
 
746 swalkenh 598
  /* The normal cursor. */
599
  private Cursor normalCursor = new Cursor(Cursor.DEFAULT_CURSOR);
521 swalkenh 600
 
746 swalkenh 601
  /* The moving cursor. */
602
  private Cursor moveCursor = new Cursor(Cursor.MOVE_CURSOR);
603
 
604
  /* The resizing cursor. */
605
  private Cursor resizeCursor = new Cursor(Cursor.SE_RESIZE_CURSOR);
606
 
607
  /* The moving flag: true if some region is moving at the moment. */
608
  private boolean inMove = false;
609
 
610
  /* The resizing flag: true if some region is resizing at the moment. */
611
  private boolean inResize = false;
612
 
613
  /* The region popup menu. */
614
  private JPopupMenu popup = new JPopupMenu();
615
 
616
  /* The popup menu item to delete the region. */
617
  private JMenuItem deleteSelectedItem = new JMenuItem("Delete the region");
618
 
619
  /** The class constructor creates all elements for the RegionEditor plugin. */
620
  public RegionEditorPlugin() {
621
 
622
    // Sets new layout.
623
    setLayout(new BorderLayout());
624
 
625
    // Creates the image panel.
626
    imagePanel = new ImagePanel(regions);
627
 
628
    imagePanel.addMouseMotionListener(this);
629
630
 
631
    JPanel leftPanel = new JPanel();
632
    leftPanel.setLayout(new BorderLayout());
633
 
634
    leftPanel.add(confirmButton, BorderLayout.EAST);
635
636
 
637
    JPanel rightPanel = new JPanel();
638
    rightPanel.setPreferredSize(new Dimension(240, 24));
639
 
640
    rightPanel.add(regionNameField);
641
    rightPanel.add(regionConfirmButton, BorderLayout.EAST);
642
 
643
    // Top panel contains left and right panels.
644
    JPanel topPanel = new JPanel();
645
 
646
    topPanel.add(leftPanel);
647
    topPanel.add(rightPanel, BorderLayout.EAST);
648
 
649
    add(topPanel, BorderLayout.NORTH);
650
    add(imagePanel);
651
 
652
    confirmButton.addActionListener(this);
653
    regionConfirmButton.addActionListener(this);
654
 
655
    // Init popup menu.
656
    deleteSelectedItem.addActionListener(this);
657
 
658
659
    setVisible(false);
660
 
661
662
	/**
663
 
664
	 *
665
	 * @param gui: A reference to the GUI object.
666
 
667
	public void init(GuiInterface gui) {
668
	    this.gui = gui;
669
 	}
670
671
 
672
	 * Starts the plugin.
673
	 *
674
	 * @param node: The node that the has been chosen.
675
	 * @param environment: The current document.
676
	 * @param elementPath: The <code>TreePath</code> of the selected
677
 
678
	 *
679
	 * @see src.plugins.PluginInterface#start
680
	 */
681
	public void start(Node node, Document environment, TreePath elementPath) {
682
683
    	oldNode = node;
684
 
685
    	gui.getStatusInterface().setMessage(null);
686
    	gui.getStatusInterface().setPoint(null);
687
688
         printTree(node, 0);
689
    	if (node != null) {
690
 
691
    	}
692
		
693
 
694
		TreePath workingPath = workingPath=elementPath.getParentPath();
695
696
 
697
		    // parent is set the parent of sleected element	
698
		    AdapterNode parent = (AdapterNode) workingPath.getLastPathComponent();
699
		    imageUrl = getUrlForLabel(imageName,parent);
700
 
701
		
702
    	}
703
 
704
													//if workingPath == null it can not be found in the whole document
705
		
706
        if (imageUrl==null) {
707
        	gui.getLogInterface().log(LogInterface.TYPE_ERROR,"Picture "+"\""+imageName+"\""+" not found in document.");
521 swalkenh 708
        }
709
       
746 swalkenh 710
        
711
521 swalkenh 712
 
746 swalkenh 713
    	loadImage(imageUrl);
714
715
        // load existing regions
716
        initRegions(node);
717
718
	    gui.setPluginPanel(this);
719
   		setVisible(true);
720
	}
721
722
723
724
 
725
	 * Tries to find the Url to the belonging Imagelabel among all children of 'parent'
726
	 * 
727
	 * @param label: The label of the Image
728
	 * 
729
 
730
	 * 
731
	 * @return The belonging Url. If it can not be found null is returned
732
	 *
733
	 * author Matthias Donner
734
 
735
	 * Last revision: 23-Jul-2003
736
	 */
737
 
738
    private String getUrlForLabel(String label, AdapterNode parent) {
739
	    String result;
740
		Node temp,attribTemp;
741
		NamedNodeMap nodeList;
742
		boolean exit = false;
743
 
744
			temp=parent.getChild(i).toDomNode();
745
			if (temp.hasAttributes()) {				// if the child has attributes
746
				nodeList=temp.getAttributes();
747
 
748
					attribTemp=nodeList.item(j);
749
					if (attribTemp.getNodeValue().equals(label)) { // if an attribute contains the label
750
						for (int k = 0; k<nodeList.getLength();k++){ // we look at all attributes again and try to find image urls
751
 
752
 
753
 
754
								attribute.endsWith(".png")   ) {  // an image url always end with '.jpg', '.gif', or '.png'
755
									result = nodeList.item(k).getNodeValue();
756
 
757
									
758
							}      					
759
 
760
					}
761
					
521 swalkenh 762
				}
763
 
764
 
746 swalkenh 765
 
766
			
767
		}
768
		return null; // Url not found.
769
	}
770
		
771
		
772
773
    private void initRegions(Node node)
774
    {
775
      regions.clear();
776
777
      NodeList children = node.getChildNodes();
521 swalkenh 778
      for(int i = 0; i < children.getLength(); i++) {
779
 
746 swalkenh 780
781
        if(rectNode.getNodeName().equals("RECTANGLE")) {
782
          NodeList rectChildren = rectNode.getChildNodes();
783
          int x = 0;
784
          int y = 0;
785
          int w = 1;
786
          int h = 1;
787
          String name = null;
788
789
          for(int j = 0; j < rectChildren.getLength(); j++) {
790
            Node subnode = rectChildren.item(j);
791
792
            // get coordinates
793
            if(subnode.getNodeName().equals("COORDS")) {
794
              NamedNodeMap attrs = subnode.getAttributes();
795
796
              try {
797
                x = Integer.parseInt(attrs.getNamedItem("x").getNodeValue());
798
                y = Integer.parseInt(attrs.getNamedItem("y").getNodeValue());
799
 
800
                h = Integer.parseInt(attrs.getNamedItem("h").getNodeValue());
801
              }
802
              catch(NumberFormatException ex) {
803
 
804
              }
805
            }
806
            else if(subnode.getNodeName().equals("#text")) {
807
              String value = subnode.getNodeValue().trim();
808
 
809
              if(!value.equals("")) name = value;
810
            }
521 swalkenh 811
          }
746 swalkenh 812
 
813
 
521 swalkenh 814
 
746 swalkenh 815
      }
816
    }
817
521 swalkenh 818
 
746 swalkenh 819
{
820
  if(indent == 0)
821
    System.out.println("=================================================");
822
 
823
  String name = node.getNodeName();
824
  NamedNodeMap attrs = node.getAttributes();
825
  NodeList list = node.getChildNodes();
826
827
  // indent
828
  for(int i = 0; i < indent*2; i++) System.out.print(" ");
829
830
 
831
  System.out.print(name + ":");
832
833
 
834
  if(attrs != null) {
835
    for(int i = 0; i < attrs.getLength(); i++)
836
      System.out.print(" " + attrs.item(i).getNodeName() + "=\""
837
 
838
  }
839
840
  // value
841
  if(node.getNodeValue() != null)
842
    System.out.print(" [" + node.getNodeValue() + "]");
843
  System.out.println();
844
845
  // children
846
  for(int i = 0; i < list.getLength(); i++)
847
    printTree(list.item(i), indent+1);
848
849
  if(indent == 0)
850
 
851
}
852
853
854
 
855
	 * Stops the plugin by setting it to invisible and resetting the display of the
856
	 * status panel.
857
	 *
858
	 * @see src.plugins.PluginInterface#stop
859
 
860
	public void stop() {
861
	    setVisible(false);
862
    	gui.getStatusInterface().setIcon(StatusInterface.ICON_NONE);
863
    	gui.getStatusInterface().setMessage(null);
864
 
865
  	}
866
867
	/* (non-Javadoc)
868
 
869
	 */
870
	public void setOurEventListener(OurEventListener newListener) {
871
 
872
	}
873
874
 
875
  public void forceStatusReport() {
876
    changedNode = oldNode.cloneNode(true);
877
    changedNode.getAttributes().getNamedItem("image").setNodeValue(imageName);
878
    firePluginChangedElement(oldNode, changedNode);
879
  }
880
881
 
882
    OurEvent e = new OurEvent(new Object[] {oldNode, changedNode, pluginName});
883
    ourEventListener.firedOurEvent(e);
884
  }
885
886
 
887
  {
888
  }
889
890
 
891
   *  Loads image.
892
   *
893
   *  @param fileName    the file name that must be shown
894
 
895
 
896
  {
897
    //  File is absent.
898
    currentFile = null;
899
900
    // File name is absent: status panel - "No image".
521 swalkenh 901
    if(fileName == null) {
902
      image = null;
746 swalkenh 903
      gui.getStatusInterface().setIcon(StatusInterface.ICON_WARNING);
904
      gui.getStatusInterface().setMessage("No image");
905
    }
906
    // Gets the current file from the directory where the doc is.
907
    else {
521 swalkenh 908
 
909
        File doc = gui.getCurrentFile();
910
        if(fileName.startsWith(doc.getParentFile().toString())) {
911
          fileName = fileName.replaceFirst(doc.getParentFile().toString() + "/", "");
912
        }
913
914
        if(fileName.charAt(0) == '/')
915
 
916
 
746 swalkenh 917
          currentFile = new File(doc.getParentFile(), fileName);
918
        }
919
920
        image = javax.imageio.ImageIO.read(currentFile);
921
        gui.getStatusInterface().setIcon(StatusInterface.ICON_INFORMATION);
922
 
923
      }
924
      catch(IOException ex) {
925
        gui.getLogInterface().log(
926
        LogInterface.TYPE_ERROR, "Cannot open file " + fileName);
927
 
928
        gui.getStatusInterface().setMessage("Cannot open file " + fileName);
929
      }
930
    }
931
 
932
    imagePanel.setImage(image);
933
  }
934
935
  /**
936
   *  Reaction of all buttons.
937
   *
938
   *  @param e  some event
939
   */
940
  public void actionPerformed(ActionEvent e)
941
 
942
    if(e.getSource() == confirmButton) {
943
      imageName = imageNameField.getText();
944
      forceStatusReport();
945
    }
946
947
    if(e.getSource() == regionConfirmButton) {
948
      if(selectedRegion != null) {
949
        selectedRegion.setName(regionNameField.getText());
950
        sendRegionChanged(selectedRegion);
951
      }
952
    }
953
954
    if(e.getSource() == deleteSelectedItem) {   // delete the selected region
955
 
956
    }
957
  }
958
959
960
  /**
961
 
962
   *
963
   * @see
964
   *
965
   * @param e   mouse event
966
   */
967
  public void mouseDragged(MouseEvent e)
968
  {
969
    if(e.getSource() == imagePanel && image != null) {
970
      showMouse(e.getX(), e.getY());
971
972
      if(inMove && selectedRegion != null) {  // Move selected region.
973
 
974
        double x = (e.getX() - imagePanel.getDx()) * imagePanel.getCoef();
975
        double y = (e.getY() - imagePanel.getDy()) * imagePanel.getCoef();
976
 
977
        if(x < 0) x = 0;
978
        if(y < 0) y = 0;
979
980
        if(x + (int)rect.getWidth() >= image.getWidth(null))
981
          x = image.getWidth(null) - (int)rect.getWidth() - 1;
982
        if(y + (int)rect.getHeight() >= image.getHeight(null))
983
          y = image.getHeight(null) - (int)rect.getHeight() - 1;
984
985
        rect.setLocation((int)x, (int)y);
986
        repaint();
987
      }
988
 
989
        Rectangle rect = selectedRegion.getRect();
990
        double x = (e.getX() - imagePanel.getDx()) * imagePanel.getCoef();
991
        double y = (e.getY() - imagePanel.getDy()) * imagePanel.getCoef();
992
		double w = x - rect.getX();
993
		double h = y - rect.getY();
994
995
 
996
        if(h < 1) h = 1;
997
998
        if(x >= image.getWidth(null))
999
          w = image.getWidth(null) - rect.getX();
1000
 
1001
 
1002
1003
        rect.setSize((int)w, (int)h);
1004
        repaint();
1005
      }
1006
      else {   // Creates a new region.
1007
		double x = (e.getX() - imagePanel.getDx()) * imagePanel.getCoef();
1008
		double y = (e.getY() - imagePanel.getDy()) * imagePanel.getCoef();
1009
1010
        if(x >= 0 && y >= 0 && x < image.getWidth(null) && y < image.getHeight(null)) {
1011
          inResize = true;
1012
          setSelectedRegion(new Region(null, new Rectangle(
1013
 
1014
            (int)((e.getY() - imagePanel.getDy()) * imagePanel.getCoef()), 1, 1)));
1015
          addRegion(selectedRegion);
1016
        }
1017
      }
1018
 
1019
  }
1020
1021
 
1022
   * Invoked when the mouse button has been moved on a component (with no buttons no down).
1023
   *
1024
   * @param e   mouse event
1025
   */
1026
 
1027
  {
1028
    if(e.getSource() == imagePanel && image != null) {
1029
      showMouse(e.getX(), e.getY());
1030
1031
      Region region1 = findRegion(e.getX(), e.getY(), true);  // Try move.
1032
1033
      if(region1 != null) {    // Found one.
1034
        setCursor(moveCursor);
1035
      }
1036
 
1037
        Region region2 = findRegion(e.getX(), e.getY(), false);
1038
1039
 
1040
          setCursor(resizeCursor);
1041
        }
1042
        else {                 // Nothing found.
1043
          setCursor(normalCursor);
1044
 
1045
      }
1046
    }
1047
  }
1048
1049
  /**
1050
   * Shows the current position of mouse.
1051
 
1052
   * @param e mouse event
1053
   */
1054
  public void showMouse(int mouseX, int mouseY)
1055
  {
1056
    int x = mouseX - imagePanel.getDx();
1057
    int y = mouseY - imagePanel.getDy();
1058
1059
    if(x < 0 || y < 0 || x > imagePanel.getImageWidth()
1060
      || y > imagePanel.getImageHeight())
1061
    {
1062
 
1063
    }
1064
    else {
1065
      int xx = (int)(x * imagePanel.getCoef());
1066
      int yy = (int)(y * imagePanel.getCoef());
1067
1068
      gui.getStatusInterface().setPoint(new Point(xx, yy));
1069
    }
1070
  }
1071
1072
 
1073
	 * Invoked when the mouse has been clicked on a component.
1074
 
1075
	 * @param e: A mouse event indicating that a mouse button has been
1076
	 * clicked on a component.
1077
	 */
1078
	public void mouseClicked(MouseEvent e) {
1079
	    if(e.getSource() == imagePanel && image != null) {
1080
 
1081
      		repaint();
1082
    	}
1083
	}
1084
1085
  /**
1086
   * Invoked when a mouse button has been pressed on a Component.
1087
   *
1088
   * @param e   mouse event
1089
   */
1090
 
1091
  {
1092
    if(e.getSource() == imagePanel && image != null) {
1093
      if(e.isPopupTrigger()) {           // Show popup.
1094
        showPopup(e.getX(), e.getY());
1095
      }
1096
      else {                             // Test for move/resize.
1097
        Region region1 = findRegion(e.getX(), e.getY(), true);  // Try move.
1098
1099
        if(region1 != null) {    // Found one.
1100
 
1101
          setSelectedRegion(region1);
1102
          inMove = true;
1103
        }
1104
        else {                 // Not found - try resize.
1105
          Region region2 = findRegion(e.getX(), e.getY(), false);
1106
1107
          if(region2 != null) {    // Found one.
1108
            setCursor(resizeCursor);
1109
 
1110
            inResize = true;
1111
          }
1112
          else {                 // Nothing found.
1113
 
521 swalkenh 1114
          }
746 swalkenh 1115
        }
1116
      }
1117
    }
1118
  }
521 swalkenh 1119
746 swalkenh 1120
	/**
1121
	 * Invoked when a mouse button has been released on a component.
1122
	 *
1123
	 * @param e: A mouse event indicating that a mouse button has been
1124
	 * pressed on a component.
521 swalkenh 1125
	 */
746 swalkenh 1126
 
1127
1128
		/* If the event was fired by the image panel and an image is available ... */
1129
		if(e.getSource() == imagePanel && image != null) {
1130
    		if(e.isPopupTrigger()) {
1131
	      		showPopup(e.getX(), e.getY());
1132
    		}
1133
1134
	    inMove = false;
1135
    	inResize = false;
1136
  		}
1137
	}
1138
1139
	/**
1140
 
1141
	 *
1142
	 * @see java.awt.event.MouseListener#mouseEntered
1143
	 */
1144
	public void mouseEntered(MouseEvent e) {
1145
	}
1146
1147
	/**
1148
 
1149
	 * int the status panel.
1150
	 *
1151
	 * @param e: A mouse event indicating that the cursor has left a component.
1152
	 *
1153
	 * @see java.awt.event.MouseListener#mouseExited
1154
	 */
1155
	public void mouseExited(MouseEvent e) {
1156
	    if(e.getSource() == imagePanel) {
1157
   			gui.getStatusInterface().setPoint(null);
1158
    	}
1159
  	}
1160
1161
 
1162
   * ...
1163
   *
1164
   * @param region    add the given region
1165
   */
1166
  public void addRegion(Region region)
1167
  {
1168
    regions.add(region);
1169
 
1170
  }
1171
1172
  /**
1173
   * ...
1174
   *
1175
 
1176
   */
1177
  public void deleteRegion(Region region)
1178
  {
521 swalkenh 1179
    if(selectedRegion == region) setSelectedRegion(null); // If it was the selected one.
746 swalkenh 1180
 
1181
    repaint();
1182
  }
1183
1184
  /**
1185
   * ...
1186
   *
1187
   * @param x   point of region that the user will select
1188
 
1189
   */
1190
  private void selectRegion(int x, int y)
1191
  {
1192
    int xx = (int)((x - imagePanel.getDx()) * imagePanel.getCoef());
1193
    int yy = (int)((y - imagePanel.getDy()) * imagePanel.getCoef());
1194
1195
    setSelectedRegion(null); // Reset old selection.
1196
1197
    for(int i = 0; i < regions.size(); i++) {
1198
      Region region = (Region)regions.get(i);
1199
1200
      if(region.getRect().contains(xx, yy)) { // Found one.
1201
        setSelectedRegion(region);
1202
 
1203
      }
1204
    }
1205
  }
1206
1207
  /**
1208
   * ...
1209
   *
1210
   * @param x             ...
1211
   * @param y             ...
1212
   * @param nordWest      ...
1213
 
1214
   * @return
1215
   */
1216
  private Region findRegion(int x, int y, boolean nordWest)
1217
  {
1218
    int xx = (int)((x - imagePanel.getDx()) * imagePanel.getCoef());
1219
    int yy = (int)((y - imagePanel.getDy()) * imagePanel.getCoef());
1220
1221
    Region currentRegion = null;
1222
1223
    for(int i = 0; i < regions.size(); i++) {
1224
      Region region = (Region)regions.get(i);
1225
 
1226
1227
      if(nordWest) {
1228
        if(Math.abs((int)rect.getX() - xx) < 5
1229
          && Math.abs((int)rect.getY() - yy) < 5)
1230
        {                // Found one.
1231
          currentRegion = region;
1232
          break;
1233
        }
1234
      }
1235
      else {
1236
 
1237
          && Math.abs((int)rect.getY() + (int)rect.getHeight() - yy) < 5)
1238
 
1239
          currentRegion = region;
1240
          break;
1241
 
1242
      }
1243
    }
1244
1245
    return currentRegion;
1246
  }
1247
1248
 
1249
   * ...
1250
   *
1251
   * @param x             ...
1252
   * @param y             ...
1253
   */
1254
  private void showPopup(int x, int y)
1255
  {
1256
    selectRegion(x, y);
1257
    repaint();
1258
1259
    // Disable the item if no region is selected.
1260
    deleteSelectedItem.setEnabled(selectedRegion != null);
1261
    popup.show(this, x, y);
1262
 
1263
1264
 
1265
	 * Sets the currently selected region in the image panel.
1266
	 *
1267
	 * @param region      The region selected.
1268
 
1269
	private void setSelectedRegion(Region region) {
1270
		selectedRegion = region;
1271
		imagePanel.setSelectedRegion(region);
1272
1273
		if(selectedRegion == null)
1274
		  regionNameField.setText("");
1275
		else
1276
		  regionNameField.setText(selectedRegion.getName());
1277
	}
1278
}
1279
PK
1280
çnó.	'ƒÐæ5æ5>src/plugins/regionEditorPlugin/RegionEditorPluginTransform.xsl<!-- to-direction for RegionEditor
1281
     status: not tested, should be not so long
1282
     updated to given schema from 15/07/2003 
1283
     Last Revision: 18/07/2003 by Sascha Walkenhorst -->
1284
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
1285
<xsl:output method="xml" indent="yes" />
1286
 
1287
1288
<xsl:template match="/">
1289
 
1290
</xsl:template>
1291
1292
1293
<xsl:template match="REGIONS"><!-- element-plugin association -->
1294
	<xsl:element name="REGIONS">
1295
1296
		<!-- work on attributes -->
1297
		<!-- get information of used image out of attribute 'image' -->
1298
		<xsl:attribute name="image">
1299
			<xsl:value-of select="@image" />
1300
 
1301
		<!-- copy all other attributes -->
1302
		<xsl:for-each select="attribute::*">
1303
			<xsl:if test = "not(name(.) = ('image'))">
1304
				<xsl:attribute name="{name(.)}">
1305
 
1306
				</xsl:attribute>
1307
			</xsl:if>
1308
		</xsl:for-each>
1309
1310
		<!-- work on childs -->
1311
		<!-- get information of used rectangle out of child 'RECTANGLE' -->
1312
		<xsl:for-each select="RECTANGLE">
1313
			<xsl:element name="RECTANGLE">
1314
 
1315
				<xsl:for-each select="COORDS">
1316
					<xsl:element name="COORDS">
1317
						<xsl:attribute name="x">
1318
							<xsl:value-of select="@x" />
1319
						</xsl:attribute>
1320
						<xsl:attribute name="y">
1321
							<xsl:value-of select="@y" />
1322
 
577 swalkenh 1323
						<xsl:attribute name="w">
1324
							<xsl:value-of select="@w" />
746 swalkenh 1325
						</xsl:attribute>
545 swalkenh 1326
						<xsl:attribute name="h">
1327
							<xsl:value-of select="@h" />
1328
 
1329
 
1330
							<xsl:if test = "not(name(.) = 'x')">
1331
							<xsl:if test = "not(name(.) = 'y')">
1332
							<xsl:if test = "not(name(.) = 'w')">
1333
 
1334
 
577 swalkenh 1335
									<xsl:value-of select="self::node()" />
746 swalkenh 1336
								</xsl:attribute>
545 swalkenh 1337
 
1338
						</xsl:for-each>
577 swalkenh 1339
						<xsl:for-each select="node()">
545 swalkenh 1340
							<xsl:copy-of select="self::node()" />
577 swalkenh 1341
						</xsl:for-each>
545 swalkenh 1342
						<!-- Insert an attribute which saves the original name of node,
577 swalkenh 1343
						     cause all nodes which contain data are transformed to a
545 swalkenh 1344
						     "COORDS" node. This extra information is used in back-
577 swalkenh 1345
						     transformation to restore the original name. -->
545 swalkenh 1346
						<xsl:attribute name="XMLEditorSavedNameOfNode">
1347
							<xsl:value-of select="name(.)" />
1348
						</xsl:attribute>
1349
					</xsl:element>
1350
				</xsl:for-each>
1351
 
1352
					<xsl:element name="COORDS">
577 swalkenh 1353
						<xsl:attribute name="x">
1354
							<xsl:value-of select="@x_pos" />
1355
						</xsl:attribute>
1356
						<xsl:attribute name="y">
1357
							<xsl:value-of select="@y_pos" />
1358
						</xsl:attribute>
1359
						<xsl:attribute name="w">
1360
							<xsl:value-of select="@width" />
545 swalkenh 1361
						</xsl:attribute>
577 swalkenh 1362
						<xsl:attribute name="h">
1363
							<xsl:value-of select="@height" />
1364
						</xsl:attribute>
1365
						<xsl:for-each select="attribute::*">
1366
							<xsl:if test = "not(name(.) = 'x_pos')">
1367
							<xsl:if test = "not(name(.) = 'y_pos')">
1368
							<xsl:if test = "not(name(.) = 'width')">
1369
							<xsl:if test = "not(name(.) = 'height')">
1370
								<xsl:attribute name="{name(.)}">
1371
									<xsl:value-of select="self::node()" />
1372
								</xsl:attribute>
1373
							</xsl:if></xsl:if></xsl:if></xsl:if>
1374
						</xsl:for-each>
1375
						<xsl:for-each select="node()">
1376
							<xsl:copy-of select="self::node()" />
1377
						</xsl:for-each>
1378
						<!-- Insert an attribute which saves the original name of node,
1379
						     cause all nodes which contain data are transformed to a
1380
						     "COORDS" node. This extra information is used in back-
1381
						     transformation to restore the original name. -->
1382
						<xsl:attribute name="XMLEditorSavedNameOfNode">
1383
							<xsl:value-of select="name(.)" />
746 swalkenh 1384
						</xsl:attribute>
577 swalkenh 1385
					</xsl:element>
1386
				</xsl:for-each>
1387
				<!-- copy all other childs -->
1388
				<xsl:for-each select="node()">
1389
					<xsl:if test = "not(name(.) = 'COORDS')">
1390
					<xsl:if test = "not(name(.) = 'COORD_DATA')">
1391
						<xsl:copy-of select="self::node()" />
545 swalkenh 1392
					</xsl:if></xsl:if>
577 swalkenh 1393
				</xsl:for-each>
1394
			</xsl:element>
1395
		</xsl:for-each>
1396
1397
		<!-- get information of used ellipse out of child 'ELLIPSE' -->
1398
		<xsl:for-each select="ELLIPSE">
1399
			<xsl:element name="ELLIPSE">
1400
				<!-- get coordinates -->
1401
				<xsl:for-each select="COORDS">
1402
					<xsl:element name="COORDS">
1403
						<xsl:attribute name="x">
1404
							<xsl:value-of select="@x" />
1405
						</xsl:attribute>
1406
						<xsl:attribute name="y">
1407
							<xsl:value-of select="@y" />
1408
						</xsl:attribute>
1409
						<xsl:attribute name="w">
1410
							<xsl:value-of select="@w" />
1411
						</xsl:attribute>
1412
						<xsl:attribute name="h">
1413
							<xsl:value-of select="@h" />
1414
						</xsl:attribute>
1415
						<xsl:attribute name="angle">
1416
							<xsl:value-of select="@angle" />
1417
						</xsl:attribute>
1418
						<xsl:for-each select="attribute::*">
1419
							<xsl:if test = "not(name(.) = 'x')">
746 swalkenh 1420
							<xsl:if test = "not(name(.) = 'y')">
577 swalkenh 1421
							<xsl:if test = "not(name(.) = 'w')">
1422
							<xsl:if test = "not(name(.) = 'h')">
1423
							<xsl:if test = "not(name(.) = 'angle')">
1424
								<xsl:attribute name="{name(.)}">
1425
									<xsl:value-of select="self::node()" />
1426
								</xsl:attribute>
1427
							</xsl:if></xsl:if></xsl:if></xsl:if></xsl:if>
1428
						</xsl:for-each>
1429
						<xsl:for-each select="node()">
545 swalkenh 1430
							<xsl:copy-of select="self::node()" />
577 swalkenh 1431
						</xsl:for-each>
1432
					</xsl:element>
1433
				</xsl:for-each>
1434
				<!-- copy all other childs -->
545 swalkenh 1435
				<xsl:for-each select="node()">
1436
					<xsl:if test = "not(name(.) = 'COORDS')">
1437
						<xsl:copy-of select="self::node()" />
577 swalkenh 1438
 
1439
				</xsl:for-each>
1440
			</xsl:element>
1441
		</xsl:for-each>
1442
1443
		<!-- get information of used polyline out of child 'POLYLINE' -->
1444
		<xsl:for-each select="POLYLINE">
1445
			<xsl:element name="POLYLINE">
1446
				<!-- get coordinates -->
1447
				<xsl:for-each select="COORDS">
1448
					<xsl:element name="COORDS">
1449
						<xsl:attribute name="x">
1450
							<xsl:value-of select="@x" />
1451
						</xsl:attribute>
1452
						<xsl:attribute name="y">
1453
							<xsl:value-of select="@y" />
1454
						</xsl:attribute>
1455
						<xsl:for-each select="attribute::*">
1456
							<xsl:if test = "not(name(.) = 'x')">
1457
							<xsl:if test = "not(name(.) = 'y')">
1458
								<xsl:attribute name="{name(.)}">
1459
									<xsl:value-of select="self::node()" />
1460
								</xsl:attribute>
1461
							</xsl:if></xsl:if>
1462
						</xsl:for-each>
1463
						<xsl:for-each select="node()">
1464
							<xsl:copy-of select="self::node()" />
1465
						</xsl:for-each>
1466
					</xsl:element>
1467
				</xsl:for-each>
1468
				<!-- copy all other childs -->
1469
				<xsl:for-each select="node()">
1470
					<xsl:if test = "not(name(.) = 'COORDS')">
1471
						<xsl:copy-of select="self::node()" />
1472
					</xsl:if>
1473
				</xsl:for-each>
1474
			</xsl:element>
1475
		</xsl:for-each>
1476
1477
		<!-- copy all other childs -->
1478
		<xsl:for-each select="node()">
1479
			<xsl:if test = "not(name(.) = 'RECTANGLE')">
1480
			<xsl:if test = "not(name(.) = 'ELLIPSE')">
1481
			<xsl:if test = "not(name(.) = 'POLYLINE')">
1482
				<xsl:copy-of select="self::node()" />
1483
			</xsl:if></xsl:if></xsl:if>
1484
 
1485
1486
	</xsl:element>
1487
</xsl:template>
1488
1489
<xsl:template match="REGIONSET"><!-- element-plugin association -->
1490
	<xsl:element name="REGIONSET">
1491
1492
		<!-- work on attributes -->
1493
		<!-- get information of used image out of attribute 'image' -->
1494
		<xsl:attribute name="image">
1495
			<xsl:value-of select="@image" />
1496
		</xsl:attribute>
1497
		<!-- copy all other attributes -->
1498
		<xsl:for-each select="attribute::*">
1499
			<xsl:if test = "not(name(.) = ('image'))">
1500
				<xsl:attribute name="{name(.)}">
1501
					<xsl:value-of select="self::node()" />
1502
				</xsl:attribute>
1503
			</xsl:if>
1504
		</xsl:for-each>
1505
1506
		<!-- work on childs -->
1507
		<!-- get information of used rectangle out of child 'RECTANGLE' -->
1508
		<xsl:for-each select="RECTANGLE">
1509
			<xsl:element name="RECTANGLE">
1510
				<!-- get coordinates -->
1511
				<xsl:for-each select="COORDS">
1512
					<xsl:element name="COORDS">
1513
						<xsl:attribute name="x">
1514
							<xsl:value-of select="@x" />
1515
						</xsl:attribute>
1516
						<xsl:attribute name="y">
1517
							<xsl:value-of select="@y" />
1518
 
1519
						<xsl:attribute name="w">
545 swalkenh 1520
							<xsl:value-of select="@w" />
577 swalkenh 1521
						</xsl:attribute>
1522
						<xsl:attribute name="h">
1523
							<xsl:value-of select="@h" />
545 swalkenh 1524
						</xsl:attribute>
577 swalkenh 1525
						<xsl:for-each select="attribute::*">
545 swalkenh 1526
							<xsl:if test = "not(name(.) = 'x')">
1527
 
1528
							<xsl:if test = "not(name(.) = 'w')">
1529
							<xsl:if test = "not(name(.) = 'h')">
1530
 
1531
									<xsl:value-of select="self::node()" />
577 swalkenh 1532
								</xsl:attribute>
1533
 
1534
						</xsl:for-each>
1535
						<xsl:for-each select="node()">
1536
							<xsl:copy-of select="self::node()" />
1537
						</xsl:for-each>
1538
						<!-- Insert an attribute which saves the original name of node,
1539
						     cause all nodes which contain data are transformed to a
1540
						     "COORDS" node. This extra information is used in back-
1541
						     transformation to restore the original name. -->
1542
						<xsl:attribute name="XMLEditorSavedNameOfNode">
1543
							<xsl:value-of select="name(.)" />
1544
						</xsl:attribute>
1545
					</xsl:element>
1546
				</xsl:for-each>
1547
 
1548
					<xsl:element name="COORDS">
1549
						<xsl:attribute name="x">
1550
							<xsl:value-of select="@x_pos" />
1551
						</xsl:attribute>
1552
						<xsl:attribute name="y">
1553
							<xsl:value-of select="@y_pos" />
1554
						</xsl:attribute>
1555
						<xsl:attribute name="w">
1556
							<xsl:value-of select="@width" />
1557
						</xsl:attribute>
1558
						<xsl:attribute name="h">
1559
							<xsl:value-of select="@height" />
1560
						</xsl:attribute>
1561
						<xsl:for-each select="attribute::*">
1562
							<xsl:if test = "not(name(.) = 'x_pos')">
1563
							<xsl:if test = "not(name(.) = 'y_pos')">
1564
							<xsl:if test = "not(name(.) = 'width')">
1565
							<xsl:if test = "not(name(.) = 'height')">
1566
								<xsl:attribute name="{name(.)}">
1567
									<xsl:value-of select="self::node()" />
1568
								</xsl:attribute>
1569
							</xsl:if></xsl:if></xsl:if></xsl:if>
1570
						</xsl:for-each>
1571
						<xsl:for-each select="node()">
1572
							<xsl:copy-of select="self::node()" />
1573
						</xsl:for-each>
1574
						<!-- Insert an attribute which saves the original name of node,
1575
						     cause all nodes which contain data are transformed to a
1576
						     "COORDS" node. This extra information is used in back-
1577
						     transformation to restore the original name. -->
1578
						<xsl:attribute name="XMLEditorSavedNameOfNode">
1579
							<xsl:value-of select="name(.)" />
746 swalkenh 1580
						</xsl:attribute>
577 swalkenh 1581
					</xsl:element>
1582
				</xsl:for-each>
1583
				<!-- copy all other childs -->
1584
				<xsl:for-each select="node()">
1585
					<xsl:if test = "not(name(.) = 'COORDS')">
1586
					<xsl:if test = "not(name(.) = 'COORD_DATA')">
1587
						<xsl:copy-of select="self::node()" />
1588
					</xsl:if></xsl:if>
1589
				</xsl:for-each>
1590
			</xsl:element>
1591
		</xsl:for-each>
1592
1593
		<!-- get information of used ellipse out of child 'ELLIPSE' -->
1594
		<xsl:for-each select="ELLIPSE">
1595
			<xsl:element name="ELLIPSE">
1596
				<!-- get coordinates -->
1597
				<xsl:for-each select="COORDS">
1598
					<xsl:element name="COORDS">
1599
						<xsl:attribute name="x">
1600
							<xsl:value-of select="@x" />
1601
						</xsl:attribute>
1602
						<xsl:attribute name="y">
1603
							<xsl:value-of select="@y" />
1604
						</xsl:attribute>
1605
						<xsl:attribute name="w">
1606
							<xsl:value-of select="@w" />
1607
						</xsl:attribute>
1608
						<xsl:attribute name="h">
1609
							<xsl:value-of select="@h" />
1610
						</xsl:attribute>
1611
						<xsl:attribute name="angle">
1612
							<xsl:value-of select="@angle" />
1613
						</xsl:attribute>
1614
						<xsl:for-each select="attribute::*">
1615
							<xsl:if test = "not(name(.) = 'x')">
746 swalkenh 1616
							<xsl:if test = "not(name(.) = 'y')">
577 swalkenh 1617
							<xsl:if test = "not(name(.) = 'w')">
1618
							<xsl:if test = "not(name(.) = 'h')">
1619
							<xsl:if test = "not(name(.) = 'angle')">
1620
								<xsl:attribute name="{name(.)}">
1621
									<xsl:value-of select="self::node()" />
1622
								</xsl:attribute>
1623
							</xsl:if></xsl:if></xsl:if></xsl:if></xsl:if>
1624
						</xsl:for-each>
1625
						<xsl:for-each select="node()">
1626
							<xsl:copy-of select="self::node()" />
1627
						</xsl:for-each>
1628
					</xsl:element>
1629
				</xsl:for-each>
1630
				<!-- copy all other childs -->
1631
				<xsl:for-each select="node()">
1632
					<xsl:if test = "not(name(.) = 'COORDS')">
1633
						<xsl:copy-of select="self::node()" />
1634
 
1635
				</xsl:for-each>
1636
			</xsl:element>
1637
		</xsl:for-each>
1638
1639
		<!-- get information of used polyline out of child 'POLYLINE' -->
1640
		<xsl:for-each select="POLYLINE">
1641
			<xsl:element name="POLYLINE">
1642
				<!-- get coordinates -->
1643
				<xsl:for-each select="COORDS">
1644
					<xsl:element name="COORDS">
1645
						<xsl:attribute name="x">
1646
							<xsl:value-of select="@x" />
1647
						</xsl:attribute>
1648
						<xsl:attribute name="y">
1649
							<xsl:value-of select="@y" />
1650
						</xsl:attribute>
1651
						<xsl:for-each select="attribute::*">
1652
							<xsl:if test = "not(name(.) = 'x')">
1653
							<xsl:if test = "not(name(.) = 'y')">
1654
								<xsl:attribute name="{name(.)}">
1655
									<xsl:value-of select="self::node()" />
1656
								</xsl:attribute>
1657
							</xsl:if></xsl:if>
1658
						</xsl:for-each>
1659
						<xsl:for-each select="node()">
1660
							<xsl:copy-of select="self::node()" />
1661
						</xsl:for-each>
1662
					</xsl:element>
1663
				</xsl:for-each>
1664
				<!-- copy all other childs -->
1665
				<xsl:for-each select="node()">
1666
					<xsl:if test = "not(name(.) = 'COORDS')">
1667
						<xsl:copy-of select="self::node()" />
1668
					</xsl:if>
1669
				</xsl:for-each>
1670
			</xsl:element>
1671
		</xsl:for-each>
1672
1673
		<!-- copy all other childs -->
1674
		<xsl:for-each select="node()">
1675
			<xsl:if test = "not(name(.) = 'RECTANGLE')">
1676
			<xsl:if test = "not(name(.) = 'ELLIPSE')">
1677
			<xsl:if test = "not(name(.) = 'POLYLINE')">
1678
				<xsl:copy-of select="self::node()" />
1679
			</xsl:if></xsl:if></xsl:if>
1680
 
1681
1682
	</xsl:element>
1683
</xsl:template>
1684
1685
1686
</xsl:stylesheet>PK
1687
ù|÷.
ˆWäÍ*Í*Bsrc/plugins/regionEditorPlugin/RegionEditorPluginTransformBack.xsl<!-- back-direction for RegionEditor
1688
     status: not tested
1689
     updated to given schema from 15/07/2003 
1690
     Last Revision: 18/07/2003 by Sascha Walkenhorst -->
1691
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
1692
<xsl:output method="xml" indent="yes" />
1693
1694
1695
<xsl:template match="/">
1696
	<xsl:apply-templates />
1697
</xsl:template>
1698
1699
1700
<xsl:template match="REGIONS"><!-- element-plugin association -->
1701
	<xsl:element name="REGIONS">
1702
1703
		<!-- work on attributes -->
1704
		<!-- get information of used image out of attribute 'image' -->
1705
		<xsl:attribute name="image">
1706
			<xsl:value-of select="@image" />
1707
		</xsl:attribute>
1708
		<!-- copy all other attributes -->
1709
		<xsl:for-each select="attribute::*">
1710
			<xsl:if test = "not(name(.) = ('image'))">
1711
				<xsl:attribute name="{name(.)}">
1712
					<xsl:value-of select="self::node()" />
1713
				</xsl:attribute>
1714
 
1715
		</xsl:for-each>
1716
1717
		<!-- work on childs -->
1718
		<!-- get information of used rectangle out of child 'RECTANGLE' -->
1719
		<xsl:for-each select="RECTANGLE">
1720
			<xsl:element name="RECTANGLE">
1721
				<!-- get coordinates -->
1722
				<!-- during transformation in to-direction an attribute named 
1723
 
1724
				     contains the name of the element the original element had.
545 swalkenh 1725
				     With this information can the original element reconstructed.-->
1726
 
1727
 
240 swalkenh 1728
					<xsl:element name="$temp">
746 swalkenh 1729
 
1730
							<xsl:value-of select="@x" />
577 swalkenh 1731
						</xsl:attribute>
1732
						<xsl:attribute name="y">
746 swalkenh 1733
							<xsl:value-of select="@y" />
545 swalkenh 1734
						</xsl:attribute>
1735
						<xsl:attribute name="w">
1736
 
1737
 
1738
						<xsl:attribute name="h">
1739
							<xsl:value-of select="@h" />
1740
						</xsl:attribute>
1741
 
1742
 
577 swalkenh 1743
							<xsl:if test = "not(name(.) = 'y')">
1744
							<xsl:if test = "not(name(.) = 'w')">
545 swalkenh 1745
 
1746
							<xsl:if test = "not(name(.) = 'XMLEditorSavedNameOfNode')">
577 swalkenh 1747
								<xsl:attribute name="{name(.)}">
1748
									<xsl:value-of select="self::node()" />
545 swalkenh 1749
								</xsl:attribute>
1750
							</xsl:if></xsl:if></xsl:if></xsl:if></xsl:if>
577 swalkenh 1751
						</xsl:for-each>
545 swalkenh 1752
						<xsl:for-each select="node()">
1753
							<xsl:copy-of select="self::node()" />
1754
						</xsl:for-each>
1755
					</xsl:element>
1756
				</xsl:for-each>
1757
1758
				<!-- copy all other childs -->
1759
 
1760
					<xsl:if test = "not(name(.) = 'COORDS')">
577 swalkenh 1761
						<xsl:copy-of select="self::node()" />
1762
					</xsl:if>
1763
				</xsl:for-each>
1764
			</xsl:element>
746 swalkenh 1765
		</xsl:for-each>
1766
1767
		<!-- get information of used ellipse out of child 'ELLIPSE' -->
1768
		<xsl:for-each select="ELLIPSE">
577 swalkenh 1769
			<xsl:element name="ELLIPSE">
746 swalkenh 1770
				<!-- get coordinates -->
1771
				<xsl:for-each select="COORDS">
577 swalkenh 1772
					<xsl:element name="COORDS">
1773
						<xsl:attribute name="x">
545 swalkenh 1774
							<xsl:value-of select="@x" />
577 swalkenh 1775
						</xsl:attribute>
1776
						<xsl:attribute name="y">
1777
							<xsl:value-of select="@y" />
1778
						</xsl:attribute>
1779
						<xsl:attribute name="w">
1780
							<xsl:value-of select="@w" />
1781
						</xsl:attribute>
1782
						<xsl:attribute name="h">
1783
							<xsl:value-of select="@h" />
1784
						</xsl:attribute>
1785
						<xsl:attribute name="angle">
1786
							<xsl:value-of select="@angle" />
1787
						</xsl:attribute>
1788
						<xsl:for-each select="attribute::*">
746 swalkenh 1789
							<xsl:if test = "not(name(.) = 'x')">
577 swalkenh 1790
							<xsl:if test = "not(name(.) = 'y')">
1791
							<xsl:if test = "not(name(.) = 'w')">
1792
							<xsl:if test = "not(name(.) = 'h')">
746 swalkenh 1793
							<xsl:if test = "not(name(.) = 'angle')">
577 swalkenh 1794
								<xsl:attribute name="{name(.)}">
1795
									<xsl:value-of select="self::node()" />
1796
								</xsl:attribute>
1797
							</xsl:if></xsl:if></xsl:if></xsl:if></xsl:if>
1798
						</xsl:for-each>
545 swalkenh 1799
						<xsl:for-each select="node()">
746 swalkenh 1800
 
577 swalkenh 1801
						</xsl:for-each>
545 swalkenh 1802
					</xsl:element>
577 swalkenh 1803
				</xsl:for-each>
1804
				<!-- copy all other childs -->
746 swalkenh 1805
				<xsl:for-each select="node()">
545 swalkenh 1806
					<xsl:if test = "not(name(.) = 'COORDS')">
1807
						<xsl:copy-of select="self::node()" />
1808
					</xsl:if>
577 swalkenh 1809
 
1810
			</xsl:element>
1811
		</xsl:for-each>
1812
1813
		<!-- get information of used polyline out of child 'POLYLINE' -->
1814
		<xsl:for-each select="POLYLINE">
1815
			<xsl:element name="POLYLINE">
1816
				<!-- get coordinates -->
1817
				<xsl:for-each select="COORDS">
1818
					<xsl:element name="COORDS">
1819
						<xsl:attribute name="x">
1820
							<xsl:value-of select="@x" />
1821
						</xsl:attribute>
1822
						<xsl:attribute name="y">
1823
							<xsl:value-of select="@y" />
1824
						</xsl:attribute>
1825
						<xsl:for-each select="attribute::*">
1826
							<xsl:if test = "not(name(.) = 'x')">
1827
							<xsl:if test = "not(name(.) = 'y')">
1828
								<xsl:attribute name="{name(.)}">
1829
									<xsl:value-of select="self::node()" />
1830
								</xsl:attribute>
1831
							</xsl:if></xsl:if>
1832
						</xsl:for-each>
1833
						<xsl:for-each select="node()">
1834
							<xsl:copy-of select="self::node()" />
1835
						</xsl:for-each>
1836
					</xsl:element>
1837
				</xsl:for-each>
1838
				<!-- copy all other childs -->
1839
				<xsl:for-each select="node()">
1840
					<xsl:if test = "not(name(.) = 'COORDS')">
1841
						<xsl:copy-of select="self::node()" />
1842
					</xsl:if>
1843
				</xsl:for-each>
1844
			</xsl:element>
1845
		</xsl:for-each>
1846
1847
		<!-- copy all other childs -->
1848
		<xsl:for-each select="node()">
1849
			<xsl:if test = "not(name(.) = 'RECTANGLE')">
1850
			<xsl:if test = "not(name(.) = 'ELLIPSE')">
1851
			<xsl:if test = "not(name(.) = 'POLYLINE')">
1852
				<xsl:copy-of select="self::node()" />
1853
			</xsl:if></xsl:if></xsl:if>
1854
		</xsl:for-each>
1855
 
1856
	</xsl:element>
1857
</xsl:template>
1858
1859
<xsl:template match="REGIONSET"><!-- element-plugin association -->
1860
	<xsl:element name="REGIONSET">
1861
1862
		<!-- work on attributes -->
1863
		<!-- get information of used image out of attribute 'image' -->
1864
		<xsl:attribute name="image">
1865
			<xsl:value-of select="@image" />
1866
		</xsl:attribute>
1867
		<!-- copy all other attributes -->
1868
		<xsl:for-each select="attribute::*">
1869
			<xsl:if test = "not(name(.) = ('image'))">
1870
				<xsl:attribute name="{name(.)}">
1871
					<xsl:value-of select="self::node()" />
1872
				</xsl:attribute>
1873
			</xsl:if>
1874
		</xsl:for-each>
1875
1876
		<!-- work on childs -->
1877
		<!-- get information of used rectangle out of child 'RECTANGLE' -->
1878
		<xsl:for-each select="RECTANGLE">
1879
			<xsl:element name="RECTANGLE">
1880
				<!-- get coordinates -->
1881
				<!-- during transformation in to-direction an attribute named 
1882
				     "XMLEditorSavedNameOfNode" should have been created which
1883
				     contains the name of the element the original element had.
1884
				     With this information can the original element reconstructed.-->
1885
				<xsl:for-each select="COORDS">
1886
					<xsl:variable name="temp" select="@XMLEditorSavedNameOfNode" />
1887
					<xsl:element name="$temp">
1888
						<xsl:attribute name="x">
1889
 
1890
						</xsl:attribute>
545 swalkenh 1891
						<xsl:attribute name="y">
577 swalkenh 1892
							<xsl:value-of select="@y" />
1893
						</xsl:attribute>
1894
						<xsl:attribute name="w">
545 swalkenh 1895
							<xsl:value-of select="@w" />
577 swalkenh 1896
						</xsl:attribute>
545 swalkenh 1897
						<xsl:attribute name="h">
1898
 
1899
						</xsl:attribute>
1900
						<xsl:for-each select="attribute::*">
1901
 
577 swalkenh 1902
							<xsl:if test = "not(name(.) = 'y')">
1903
							<xsl:if test = "not(name(.) = 'w')">
1904
 
1905
							<xsl:if test = "not(name(.) = 'XMLEditorSavedNameOfNode')">
1906
								<xsl:attribute name="{name(.)}">
1907
									<xsl:value-of select="self::node()" />
1908
								</xsl:attribute>
1909
							</xsl:if></xsl:if></xsl:if></xsl:if></xsl:if>
1910
						</xsl:for-each>
1911
						<xsl:for-each select="node()">
1912
							<xsl:copy-of select="self::node()" />
1913
						</xsl:for-each>
1914
					</xsl:element>
1915
				</xsl:for-each>
1916
1917
				<!-- copy all other childs -->
1918
 
1919
					<xsl:if test = "not(name(.) = 'COORDS')">
1920
						<xsl:copy-of select="self::node()" />
1921
					</xsl:if>
1922
				</xsl:for-each>
1923
			</xsl:element>
746 swalkenh 1924
		</xsl:for-each>
1925
1926
		<!-- get information of used ellipse out of child 'ELLIPSE' -->
1927
		<xsl:for-each select="ELLIPSE">
577 swalkenh 1928
			<xsl:element name="ELLIPSE">
746 swalkenh 1929
				<!-- get coordinates -->
1930
				<xsl:for-each select="COORDS">
577 swalkenh 1931
					<xsl:element name="COORDS">
1932
						<xsl:attribute name="x">
1933
							<xsl:value-of select="@x" />
1934
						</xsl:attribute>
1935
						<xsl:attribute name="y">
1936
							<xsl:value-of select="@y" />
1937
						</xsl:attribute>
1938
						<xsl:attribute name="w">
1939
							<xsl:value-of select="@w" />
1940
						</xsl:attribute>
1941
						<xsl:attribute name="h">
1942
							<xsl:value-of select="@h" />
1943
						</xsl:attribute>
1944
						<xsl:attribute name="angle">
1945
							<xsl:value-of select="@angle" />
1946
						</xsl:attribute>
1947
						<xsl:for-each select="attribute::*">
746 swalkenh 1948
							<xsl:if test = "not(name(.) = 'x')">
577 swalkenh 1949
							<xsl:if test = "not(name(.) = 'y')">
1950
							<xsl:if test = "not(name(.) = 'w')">
1951
							<xsl:if test = "not(name(.) = 'h')">
746 swalkenh 1952
							<xsl:if test = "not(name(.) = 'angle')">
577 swalkenh 1953
								<xsl:attribute name="{name(.)}">
1954
									<xsl:value-of select="self::node()" />
1955
								</xsl:attribute>
1956
							</xsl:if></xsl:if></xsl:if></xsl:if></xsl:if>
1957
						</xsl:for-each>
1958
						<xsl:for-each select="node()">
746 swalkenh 1959
 
577 swalkenh 1960
						</xsl:for-each>
1961
					</xsl:element>
1962
				</xsl:for-each>
1963
				<!-- copy all other childs -->
746 swalkenh 1964
				<xsl:for-each select="node()">
577 swalkenh 1965
					<xsl:if test = "not(name(.) = 'COORDS')">
1966
						<xsl:copy-of select="self::node()" />
1967
					</xsl:if>
1968
 
1969
			</xsl:element>
1970
		</xsl:for-each>
1971
1972
		<!-- get information of used polyline out of child 'POLYLINE' -->
1973
		<xsl:for-each select="POLYLINE">
1974
			<xsl:element name="POLYLINE">
1975
				<!-- get coordinates -->
1976
				<xsl:for-each select="COORDS">
1977
					<xsl:element name="COORDS">
1978
						<xsl:attribute name="x">
1979
							<xsl:value-of select="@x" />
1980
						</xsl:attribute>
1981
						<xsl:attribute name="y">
1982
							<xsl:value-of select="@y" />
1983
						</xsl:attribute>
1984
						<xsl:for-each select="attribute::*">
1985
							<xsl:if test = "not(name(.) = 'x')">
1986
							<xsl:if test = "not(name(.) = 'y')">
1987
								<xsl:attribute name="{name(.)}">
1988
									<xsl:value-of select="self::node()" />
1989
								</xsl:attribute>
1990
							</xsl:if></xsl:if>
1991
						</xsl:for-each>
1992
						<xsl:for-each select="node()">
1993
							<xsl:copy-of select="self::node()" />
1994
						</xsl:for-each>
1995
					</xsl:element>
1996
				</xsl:for-each>
1997
				<!-- copy all other childs -->
1998
				<xsl:for-each select="node()">
1999
					<xsl:if test = "not(name(.) = 'COORDS')">
2000
						<xsl:copy-of select="self::node()" />
2001
					</xsl:if>
2002
				</xsl:for-each>
2003
			</xsl:element>
2004
		</xsl:for-each>
2005
2006
		<!-- copy all other childs -->
2007
		<xsl:for-each select="node()">
2008
			<xsl:if test = "not(name(.) = 'RECTANGLE')">
2009
			<xsl:if test = "not(name(.) = 'ELLIPSE')">
2010
			<xsl:if test = "not(name(.) = 'POLYLINE')">
2011
				<xsl:copy-of select="self::node()" />
2012
			</xsl:if></xsl:if></xsl:if>
2013
		</xsl:for-each>
2014
 
2015
	</xsl:element>
2016
</xsl:template>
2017
2018
2019
</xsl:stylesheet>PK
2020
2021
2022
}÷.	META-INF/þÊPK
2023
2024
2025
}÷.ñÍSºMM+META-INF/MANIFEST.MFPK
2026
2027
{÷.‘ƒÖ»»/ªsrc/plugins/regionEditorPlugin/ImagePanel.classPK
2028
2029
Do÷.ÆL7Œ.²src/plugins/regionEditorPlugin/ImagePanel.javaPK
2030
2031
{÷.h®‘¡ÂÂ+!src/plugins/regionEditorPlugin/Region.classPK
2032
2033
Do÷.·`΂ÉÉ*(%src/plugins/regionEditorPlugin/Region.javaPK
2034
2035
{÷.ŸÙæKI;I;79*src/plugins/regionEditorPlugin/RegionEditorPlugin.classPK
2036
2037
	u÷.©­–û%X%X6×esrc/plugins/regionEditorPlugin/RegionEditorPlugin.javaPK
2038
2039
çnó.	'ƒÐæ5æ5>P¾src/plugins/regionEditorPlugin/RegionEditorPluginTransform.xslPK
2040
2041
ù|÷.
ˆWäÍ*Í*B’ôsrc/plugins/regionEditorPlugin/RegionEditorPluginTransformBack.xslPK
2042
2043
Œ¿