Revision 109

View differences:

trunk/libraries/libCq CMS for java.old/ant.xml
9 9
  <property name="jar" value="cms"/>
10 10
  <!--property name="fmapdir" value="../FMap"/-->
11 11
  <property name="targetDir" location="c:\eclipse2\workspace\GVSIG\lib"/>
12
  <property name="targetDir2" location="."/>
12 13

  
13 14
  <target name="init">
14 15
    <!-- Create the time stamp -->
......
29 30
    <mkdir dir="${dist}"/>
30 31

  
31 32
    <!-- Put everything in ${build} into the cms-${DSTAMP}.jar file -->
32
    <copy todir="${build}">
33
    	<fileset dir="${src}" includes="**"/>
34
    </copy>
33
   
35 34
    <jar jarfile="${dist}/${jar}.jar" basedir="${build}"/>
35
    <jar jarfile="${dist}/${jar}.jar" basedir="." includes = "images/*.gif" update="true" />
36 36
    <copy todir="${dist}">
37 37
    	<fileset dir="./lib" includes="*.jar"/>
38 38
    </copy>
39

  
39
    <copy todir="${targetDir2}/">
40
    	<fileset dir="${dist}" includes="${jar}.jar"/>
41
    </copy>
40 42
    <move todir="${targetDir}/">
41 43
    	<fileset dir="${dist}" includes="**/**"/>
42 44
    </move>
trunk/libraries/libCq CMS for java.old/.project
1 1
<?xml version="1.0" encoding="UTF-8"?>
2 2
<projectDescription>
3
	<name>CMS for Java</name>
3
	<name>Cq CMS for Java</name>
4 4
	<comment></comment>
5 5
	<projects>
6 6
		<project>CIT MapView</project>
7 7
		<project>CqMDT</project>
8
		<project>jmGRasterLib</project>
8 9
	</projects>
9 10
	<buildSpec>
10 11
		<buildCommand>
trunk/libraries/libCq CMS for java.old/src/org/cresques/io/BookmarkList.java
1
/*
2
 * Creado el 31-ago-2004
3
 */
4
package org.cresques.io;
5

  
6
import java.awt.event.ActionEvent;
7
import java.awt.event.ActionListener;
8
import java.util.Iterator;
9
import java.util.Map;
10
import java.util.TreeMap;
11
import java.util.Vector;
12

  
13
import javax.swing.ImageIcon;
14
import javax.swing.JMenu;
15
import javax.swing.JMenuItem;
16

  
17
import org.cresques.cts.IProjection;
18
import org.cresques.ui.CQApp;
19

  
20
/**
21
 * @author "Luis W. Sevilla" <sevilla_lui@gva.es>
22
 */
23
class Bookmark {
24
	String folder;
25
	String name;
26
	String fName;
27
	String projName;
28
	IProjection proj;
29
	
30
	public Bookmark(String fld, String n, String f, IProjection p) {
31
		projName = null;
32
		folder = fld; name = n; fName = f; proj = p;
33
	}
34
}
35

  
36
public class BookmarkList extends TreeMap implements ActionListener {
37
	CQApp app = null;
38
	
39
	public BookmarkList(CQApp mainApp) {
40
		app = mainApp;
41
		loadList();
42
	}
43
	
44
	public void loadList() {
45
	}
46
	
47
	public void addEntry(String fld, String n, String f, IProjection p) {
48
		addEntry(new Bookmark(fld, n, f, p));
49
	}
50
	
51
	public void addEntry(Bookmark bookmark) {
52
		Vector vector;
53
		if (containsKey(bookmark.folder)) {
54
			vector = (Vector) get(bookmark.folder);
55
		} else {
56
			vector = new Vector();
57
		}
58
		vector.add(bookmark);
59
		put(bookmark.folder, vector);
60
	}
61
	
62
	public JMenu getJMenu() {
63
		JMenuItem it = null;
64
		JMenu menu = null, menu2 = null;
65
		ClassLoader loader = this.getClass().getClassLoader();
66
		//loader.getResource("images/"+"folderXP.gif");
67
		//System.err.println("URL="+loader.getResource("images/"+"folderXP.gif"));
68
		ImageIcon folderIcon = new ImageIcon(loader.getResource("images/"+"folderXP.gif"));
69
		ImageIcon dxfIcon = new ImageIcon(loader.getResource("images/"+"fileXPdxf.gif"));
70
		ImageIcon gmlIcon = new ImageIcon(loader.getResource("images/"+"fileXPgml.gif"));
71
		ImageIcon ecwIcon = new ImageIcon(loader.getResource("images/"+"fileXPecw.gif"));
72
		ImageIcon tifIcon = new ImageIcon(loader.getResource("images/"+"fileXPtif.gif"));
73
		ImageIcon fileIcon = new ImageIcon(loader.getResource("images/"+"fileXP.gif"));
74
		
75
		menu = new JMenu("Favoritos");
76
		menu.setMnemonic('F');
77
		
78
		// Arbol de carpetas
79
		TreeMap menuMap = new TreeMap();
80
		String [] menuNames;
81
		JMenu parentMenu = null;
82
		String mName = null, key = null;;
83

  
84
		Iterator mIter = keySet().iterator();
85
		while (mIter.hasNext()) {
86
			key = (String) mIter.next();
87
			System.out.println("Key:"+key);
88
			menuNames = key.split("\\|");
89
			
90
			parentMenu = menu;
91
			mName = "";
92
			for (int i=0; i<menuNames.length; i++) {
93
				if (i>0) mName += "|";
94
				mName += menuNames[i];
95
				if (menuMap.containsKey(mName)) {
96
					//System.out.println(" mName:"+mName+", parent:"+parentMenu.getText());
97
					parentMenu = (JMenu) menuMap.get(mName);
98
				} else {
99
					//System.out.println("+mName:"+mName+", parent:"+parentMenu.getText());
100
					menu2 = new JMenu(menuNames[i]);
101
					menu2.setIcon(folderIcon);
102
					parentMenu.add(menu2);
103
					menuMap.put(mName, menu2);
104
					parentMenu = menu2;
105
				}
106
			}
107
		}
108
		
109
		// Entradas (Bookmarks)
110
		mIter = entrySet().iterator();
111
		while (mIter.hasNext()) {
112
			Map.Entry entry = (Map.Entry) mIter.next();
113
			String folder = (String) entry.getKey();
114
			
115
			/*menu2 = new JMenu(folder);
116
			menu2.setIcon(folderIcon);
117
			menu.add(menu2);*/
118
			menu2 = (JMenu) menuMap.get(folder);
119

  
120
			Vector vector = ((Vector) entry.getValue());
121
			Bookmark bookmark;
122
			for (int i=0; i<vector.size(); i++) {
123
				bookmark = (Bookmark) vector.get(i);
124
				it = new JMenuItem(bookmark.name);
125
				it.setActionCommand(i+"|"+folder);
126
				it.addActionListener(this);
127
				if (bookmark.fName.endsWith("tif"))
128
					it.setIcon(tifIcon);
129
				else if (bookmark.fName.endsWith("ecw"))
130
					it.setIcon(ecwIcon);
131
				else if (bookmark.fName.endsWith("gml"))
132
					it.setIcon(gmlIcon);
133
				else if (bookmark.fName.endsWith("dxf") || bookmark.fName.endsWith("DXF"))
134
					it.setIcon(dxfIcon);
135
				else
136
					it.setIcon(fileIcon);
137

  
138
				menu2.add(it);
139
			}
140
		}
141
		//menu.add(menu2);
142
		return menu;
143
	}
144
	
145
	public void actionPerformed(ActionEvent event) {
146
		IProjection proj = null;
147
		String cmd = event.getActionCommand();
148
		int mark = cmd.indexOf('|');
149
		int vectorPos = Integer.parseInt(cmd.substring(0,mark));
150
		cmd = cmd.substring(mark+1);
151
		Bookmark bookmark = (Bookmark) ((Vector) get(cmd)).get(vectorPos);
152
		app.loadFile(bookmark.fName, bookmark.proj);
153
	}
154
}
155

  
0 156

  
trunk/libraries/libCq CMS for java.old/src/org/cresques/ui/CQMapCanvas.java
3 3
 */
4 4
package org.cresques.ui;
5 5

  
6
import java.awt.geom.Point2D;
7

  
8 6
import org.cresques.geo.ViewPortData;
9 7

  
10 8
/**
......
17 15
	
18 16
	public void viewPortChanged();
19 17
	
20
	//public void zoom(double zoom, Point2D pt);
21
	
22 18
	public void repaint();
23 19
	
24 20
}
trunk/libraries/libCq CMS for java.old/src/org/cresques/ui/CQCursor.java
1
/*
2
 * Creado el 24-ago-2004
3
 */
4
package org.cresques.ui;
5

  
6
import java.awt.Cursor;
7
import java.awt.Point;
8
import java.awt.Toolkit;
9

  
10
/**
11
 * @author "Luis W. Sevilla" <sevilla_lui@gva.es>
12
 */
13
public class CQCursor {
14
	public static int ZOOMIN_CURSOR	= 0x100;
15
	public static int ZOOMOUT_CURSOR	= 0x101;
16
	public static int PAN_CURSOR		= 0x102;
17
	public static int SELECT_CURSOR	= 0x103;
18
	public static int INFO_CURSOR		= 0x104;
19
	private static int MAXCURSORNR	= 15;
20
	private static Cursor [] cursores = null;
21
	
22
	static {
23
		cursores = new Cursor[MAXCURSORNR];
24
		cursores[ZOOMIN_CURSOR - 0x100] = Toolkit.getDefaultToolkit().createCustomCursor(
25
			Toolkit.getDefaultToolkit().getImage("images/zi_cur.gif"),
26
			new Point(6,5), "ZoomMas");
27
		cursores[ZOOMOUT_CURSOR - 0x100] = Toolkit.getDefaultToolkit().createCustomCursor(
28
			Toolkit.getDefaultToolkit().getImage("images/zo_cur.gif"),
29
			new Point(6,5), "ZoomMenos");
30
		cursores[PAN_CURSOR - 0x100] = Toolkit.getDefaultToolkit().createCustomCursor(
31
			Toolkit.getDefaultToolkit().getImage("images/pan_cur.gif"),
32
			new Point(3,3), "Pan");
33
		cursores[SELECT_CURSOR - 0x100] = Toolkit.getDefaultToolkit().createCustomCursor(
34
				Toolkit.getDefaultToolkit().getImage("images/select_cur.gif"),
35
				new Point(6,1), "Select");
36
		cursores[INFO_CURSOR - 0x100] = Toolkit.getDefaultToolkit().createCustomCursor(
37
				Toolkit.getDefaultToolkit().getImage("images/info_cur.gif"),
38
				new Point(5, 26), "Info");
39
	}
40
	
41
	public static Cursor getCursor(int type) {
42
		Cursor cursor = null;
43
		if (type < 0x100)
44
			cursor = new Cursor(type);
45
		else if (type >= 0x100)
46
			cursor = cursores[type - 0x100];
47
		return cursor;
48
		
49
	}
50
}
0 51

  
trunk/libraries/libCq CMS for java.old/src/org/cresques/ui/cmd/CmdInfo.java
1
package org.cresques.ui.cmd;
2

  
3
import java.awt.geom.Point2D;
4

  
5
import org.cresques.ui.CQCursor;
6
import org.cresques.ui.CQMapCanvas;
7

  
8
/**
9
 * Comando info.
10
 * A?ade al canvas la capacidad de obtener informaci?n de un elemento
11
 * debajo del cursor.
12
 * @see org.cresques.geo.cover.Coverage
13
 * @author "Luis W. Sevilla" <sevilla_lui@gva.es>
14
 */
15
public class CmdInfo extends Cmd {
16
	
17
	/**
18
	 * Construye un nuevo CmdInfo para el Canvas
19
	 * @param canvas
20
	 */
21
	public CmdInfo(CQMapCanvas canvas) {
22
		super(canvas);
23
		eventsWanted = LEFT | RIGHT | PRESS;
24
		cursor = CQCursor.getCursor(CQCursor.INFO_CURSOR);
25
	}
26

  
27
	/**
28
	 * Recibe los eventos del rat?n.
29
	 */
30
	public void cmd(Point2D pt, int btn, int mouseEvent) {
31
		canvas.getApp().selectHoja(pt);
32
		canvas.repaint();
33
	}
34
}
0 35

  
trunk/libraries/libCq CMS for java.old/src/org/cresques/ui/cmd/CmdPan.java
2 2

  
3 3
import java.awt.geom.Point2D;
4 4

  
5
import org.cresques.ui.CQCursor;
5 6
import org.cresques.ui.CQMapCanvas;
6 7

  
7 8
/**
......
19 20
	public CmdPan(CQMapCanvas canvas) {
20 21
		super(canvas);
21 22
		eventsWanted = LEFT | PRESS | RELEASE;
23
		cursor = CQCursor.getCursor(CQCursor.PAN_CURSOR);
22 24
	}
23 25

  
24 26
	/**
trunk/libraries/libCq CMS for java.old/src/org/cresques/ui/cmd/Cmd.java
1 1
package org.cresques.ui.cmd;
2 2

  
3
import java.awt.Cursor;
3 4
import java.awt.geom.Point2D;
5
import java.util.TreeMap;
4 6

  
5 7
import org.cresques.ui.CQMapCanvas;
6 8

  
......
21 23
	public static final int type=0;
22 24
	CQMapCanvas canvas = null;
23 25
	int eventsWanted = 0;
26
	protected Cursor cursor = null;
27
	private static TreeMap cmdPool = null;;
24 28
	
25 29
	/**
30
	 * Inicializaci?n de la pool de comandos. 
31
	 */
32
	static {
33
		cmdPool = new TreeMap();
34
	}
35
	
36
	public static void register(String cmdStr, Cmd command) {
37
		Cmd.cmdPool.put(cmdStr, command);
38
	}
39
	
40
	public static Cmd get(String cmdStr) {
41
		 return (Cmd) Cmd.cmdPool.get(cmdStr);
42
	}
43
	
44
	/**
26 45
	 * Construye un nuevo Cmd para el Canvas
27 46
	 * @param canvas
28 47
	 */
......
42 61
	public int getEventsWanted() {
43 62
		return eventsWanted;
44 63
	}
64
	
65
	public Cursor getCursor() {
66
		return cursor;
67
	}
45 68
}
trunk/libraries/libCq CMS for java.old/src/org/cresques/ui/cmd/CmdSelect.java
2 2

  
3 3
import java.awt.geom.Point2D;
4 4

  
5
import org.cresques.ui.CQCursor;
5 6
import org.cresques.ui.CQMapCanvas;
6 7

  
7 8
/**
......
20 21
	public CmdSelect(CQMapCanvas canvas) {
21 22
		super(canvas);
22 23
		eventsWanted = LEFT | RIGHT | PRESS;
24
		cursor = CQCursor.getCursor(CQCursor.SELECT_CURSOR);
23 25
	}
24 26

  
25 27
	/**
trunk/libraries/libCq CMS for java.old/src/org/cresques/ui/cmd/CmdMeasure.java
1
package org.cresques.ui.cmd;
2

  
3
import java.awt.Cursor;
4
import java.awt.geom.Point2D;
5

  
6
import org.cresques.ui.CQCursor;
7
import org.cresques.ui.CQMapCanvas;
8

  
9
/**
10
 * Comando measure.
11
 * A?ade al canvas la capacidad de medir distancias.
12
 * @author "Luis W. Sevilla" <sevilla_lui@gva.es>
13
 */
14
public class CmdMeasure extends Cmd {
15
	private Point2D ptIni = null;
16
	
17
	/**
18
	 * Construye un nuevo CmdMeasure para el Canvas.
19
	 * @param canvas
20
	 */
21
	public CmdMeasure(CQMapCanvas canvas) {
22
		super(canvas);
23
		eventsWanted = LEFT | PRESS | RELEASE;
24
		cursor = CQCursor.getCursor(Cursor.CROSSHAIR_CURSOR);
25
	}
26

  
27
	/**
28
	 * Recibe los eventos del rat?n.
29
	 */
30
	public void cmd(Point2D pt, int btn, int mouseEvent) {
31
		if (mouseEvent == Cmd.RELEASE) {
32
			measure(ptIni, pt);
33
		} else if (mouseEvent == Cmd.PRESS) {
34
			ptIni = pt;
35
		}
36
	}
37
	
38
	/**
39
	 * Mide la distancia entre dos puntos.
40
	 * @param ptIni Punto inicial.
41
	 * @param ptFin Punto final.
42
	 */void measure(Point2D ptIni, Point2D ptFin) {
43
		//canvas.getVPData().pan(ptIni, ptFin);
44
		//canvas.viewPortChanged();
45
		//canvas.repaint();
46
	}
47
}
0 48

  
trunk/libraries/libCq CMS for java.old/src/org/cresques/ui/cmd/CmdZoom.java
5 5
import java.awt.event.MouseEvent;
6 6

  
7 7
import org.cresques.px.Extent;
8
import org.cresques.ui.CQCursor;
8 9
import org.cresques.ui.CQMapCanvas;
9 10

  
10 11
/**
......
24 25
	public CmdZoom(CQMapCanvas canvas) {
25 26
		super(canvas);
26 27
		eventsWanted = (LEFT | RIGHT | PRESS | RELEASE | DRAG);
28
		cursor = CQCursor.getCursor(CQCursor.ZOOMIN_CURSOR);
29

  
27 30
	}
28 31
	
29 32
	/**

Also available in: Unified diff