Revision 36548
tags/v_1_12_0_Build_1402/libProjection/.project | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>libProjection</name> |
|
4 |
<comment></comment> |
|
5 |
<projects> |
|
6 |
</projects> |
|
7 |
<buildSpec> |
|
8 |
<buildCommand> |
|
9 |
<name>org.eclipse.jdt.core.javabuilder</name> |
|
10 |
<arguments> |
|
11 |
</arguments> |
|
12 |
</buildCommand> |
|
13 |
</buildSpec> |
|
14 |
<natures> |
|
15 |
<nature>org.eclipse.jdt.core.javanature</nature> |
|
16 |
</natures> |
|
17 |
</projectDescription> |
|
0 | 18 |
tags/v_1_12_0_Build_1402/libProjection/src-test/org/cresques/cts/AllTests.java | ||
---|---|---|
1 |
package org.cresques.cts; |
|
2 |
|
|
3 |
import junit.framework.Test; |
|
4 |
import junit.framework.TestSuite; |
|
5 |
|
|
6 |
public class AllTests { |
|
7 |
|
|
8 |
public static Test suite() { |
|
9 |
TestSuite suite = new TestSuite("Test for org.cresques.cts"); |
|
10 |
//$JUnit-BEGIN$ |
|
11 |
|
|
12 |
//$JUnit-END$ |
|
13 |
return suite; |
|
14 |
} |
|
15 |
|
|
16 |
} |
|
0 | 17 |
tags/v_1_12_0_Build_1402/libProjection/config/text_cs.properties | ||
---|---|---|
1 |
#Translations for language [cs] |
|
2 |
#Mon Nov 06 09:04:31 CET 2006 |
|
3 |
Aceptar=Budi\u017e |
|
4 |
Aplicar=Pou\u017e\u00edt |
|
5 |
Block_Size_= |
|
6 |
Cancelar=Zru\u0161it |
|
7 |
Compression_= |
|
8 |
datum=Datum |
|
9 |
Generate_Tfw_= |
|
10 |
Interleave_= |
|
11 |
Photometric_= |
|
12 |
Progressive_= |
|
13 |
projection=Projekce |
|
14 |
reference_system=Prostorov\u00fd referen\u010dn\u00ed syst\u00e9m |
|
15 |
zone=Z\u00f3na |
|
0 | 16 |
tags/v_1_12_0_Build_1402/libProjection/config/text_fr.properties | ||
---|---|---|
1 |
#Translations for language [fr] |
|
2 |
#Mon Oct 30 09:38:21 CET 2006 |
|
3 |
Aceptar=Accepter |
|
4 |
Aplicar=Appliquer |
|
5 |
Block_Size_= |
|
6 |
Cancelar=Annuler |
|
7 |
Compression_= |
|
8 |
datum= |
|
9 |
Generate_Tfw_= |
|
10 |
Interleave_= |
|
11 |
Photometric_= |
|
12 |
Progressive_= |
|
13 |
projection= |
|
14 |
reference_system= |
|
15 |
zone= |
|
0 | 16 |
tags/v_1_12_0_Build_1402/libProjection/config/text_de.properties | ||
---|---|---|
1 |
#Translations for language [de] |
|
2 |
#Mon Oct 30 09:38:21 CET 2006 |
|
3 |
Aceptar=OK |
|
4 |
Aplicar=Anwenden |
|
5 |
Block_Size_= |
|
6 |
Cancelar=Abbrechen |
|
7 |
Compression_= |
|
8 |
datum= |
|
9 |
Generate_Tfw_= |
|
10 |
Interleave_= |
|
11 |
Photometric_= |
|
12 |
Progressive_= |
|
13 |
projection= |
|
14 |
reference_system= |
|
15 |
zone= |
|
0 | 16 |
tags/v_1_12_0_Build_1402/libProjection/config/text_eu.properties | ||
---|---|---|
1 |
#Translations for language [eu] |
|
2 |
#Mon Oct 30 09:38:21 CET 2006 |
|
3 |
Aceptar=Ados |
|
4 |
Aplicar=Aplikatu |
|
5 |
Block_Size_= |
|
6 |
Cancelar=Utzi |
|
7 |
Compression_= |
|
8 |
datum= |
|
9 |
Generate_Tfw_= |
|
10 |
Interleave_= |
|
11 |
Photometric_= |
|
12 |
Progressive_= |
|
13 |
projection= |
|
14 |
reference_system= |
|
15 |
zone= |
|
0 | 16 |
tags/v_1_12_0_Build_1402/libProjection/config/text_it.properties | ||
---|---|---|
1 |
#Translations for language [it] |
|
2 |
#Tue Nov 07 12:30:01 CET 2006 |
|
3 |
Aceptar=Accetta |
|
4 |
Aplicar=Applica |
|
5 |
Block_Size_=Dimensioni blocco\: |
|
6 |
Cancelar=Cancella |
|
7 |
Compression_=Compressione |
|
8 |
datum=Datum |
|
9 |
Generate_Tfw_=Genera Tfw\: |
|
10 |
Interleave_=Interlacciato\: |
|
11 |
Photometric_=Fotometrica\: |
|
12 |
Progressive_=Progressivo\: |
|
13 |
projection=Proiezione |
|
14 |
reference_system=Sistema di riferimento |
|
15 |
zone=Fuso |
|
0 | 16 |
tags/v_1_12_0_Build_1402/libProjection/config/text.properties | ||
---|---|---|
1 |
#Translations for language [es] |
|
2 |
#Mon Oct 30 09:38:21 CET 2006 |
|
3 |
Aceptar=Aceptar |
|
4 |
Aplicar=Aplicar |
|
5 |
Block_Size_=Tama\u00f1o de bloque\: |
|
6 |
Cancelar=Cancelar |
|
7 |
Compression_=Compresi\u00f3n\: |
|
8 |
datum=Datum |
|
9 |
Generate_Tfw_=Generar Tfw\: |
|
10 |
Interleave_=Entrelazado\: |
|
11 |
Photometric_=Fotom\u00e9trica\: |
|
12 |
Progressive_=Progresivo\: |
|
13 |
projection=Proyecci\u00f3n |
|
14 |
reference_system=Sistema de Referencia |
|
15 |
zone=Huso |
|
0 | 16 |
tags/v_1_12_0_Build_1402/libProjection/config/text_en.properties | ||
---|---|---|
1 |
#Translations for language [en] |
|
2 |
#Mon Oct 30 09:38:21 CET 2006 |
|
3 |
Aceptar=Accept |
|
4 |
Aplicar=Apply |
|
5 |
Block_Size_=Block Size\: |
|
6 |
Cancelar=Cancel |
|
7 |
Compression_=Compression\: |
|
8 |
datum=Datum |
|
9 |
Generate_Tfw_=Generate Tfw\: |
|
10 |
Interleave_=Interleave\: |
|
11 |
Photometric_=Photometric\: |
|
12 |
Progressive_=Progressive\: |
|
13 |
projection=Projection |
|
14 |
reference_system=Reference System |
|
15 |
zone=Zone |
|
0 | 16 |
tags/v_1_12_0_Build_1402/libProjection/config/text_gl.properties | ||
---|---|---|
1 |
#Translations for language [gl] |
|
2 |
#Mon Oct 30 09:38:21 CET 2006 |
|
3 |
Aceptar=Aceptar |
|
4 |
Aplicar=Aplicar |
|
5 |
Block_Size_= |
|
6 |
Cancelar=Cancelar |
|
7 |
Compression_= |
|
8 |
datum= |
|
9 |
Generate_Tfw_= |
|
10 |
Interleave_= |
|
11 |
Photometric_= |
|
12 |
Progressive_= |
|
13 |
projection= |
|
14 |
reference_system= |
|
15 |
zone= |
|
0 | 16 |
tags/v_1_12_0_Build_1402/libProjection/config/text_ca.properties | ||
---|---|---|
1 |
#Translations for language [ca] |
|
2 |
#Mon Oct 30 09:38:21 CET 2006 |
|
3 |
Aceptar=Acceptar |
|
4 |
Aplicar=Aplicar |
|
5 |
Block_Size_= |
|
6 |
Cancelar=Cancel\u00b7lar |
|
7 |
Compression_= |
|
8 |
datum= |
|
9 |
Generate_Tfw_= |
|
10 |
Interleave_= |
|
11 |
Photometric_= |
|
12 |
Progressive_= |
|
13 |
projection=Projecci\u00f3 |
|
14 |
reference_system=Sistema de refer\u00e8ncia |
|
15 |
zone= |
|
0 | 16 |
tags/v_1_12_0_Build_1402/libProjection/config/text_pt.properties | ||
---|---|---|
1 |
#Translations for language [pt] |
|
2 |
#Mon Oct 30 09:38:21 CET 2006 |
|
3 |
Aceptar=Aceitar |
|
4 |
Aplicar=Aplicar |
|
5 |
Block_Size_= |
|
6 |
Cancelar=Cancelar |
|
7 |
Compression_= |
|
8 |
datum= |
|
9 |
Generate_Tfw_= |
|
10 |
Interleave_= |
|
11 |
Photometric_= |
|
12 |
Progressive_= |
|
13 |
projection= |
|
14 |
reference_system= |
|
15 |
zone= |
|
0 | 16 |
tags/v_1_12_0_Build_1402/libProjection/src/org/cresques/Messages.java | ||
---|---|---|
1 |
/* Cresques Mapping Suite. Graphic Library for constructing mapping applications. |
|
2 |
* Copyright (C) 2006 IVER T.I. and Generalitat Valenciana. |
|
3 |
* |
|
4 |
* This program is free software; you can redistribute it and/or |
|
5 |
* modify it under the terms of the GNU General Public License |
|
6 |
* as published by the Free Software Foundation; either version 2 |
|
7 |
* of the License, or (at your option) any later version. |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
17 |
* |
|
18 |
* For more information, contact: |
|
19 |
* |
|
20 |
* Generalitat Valenciana |
|
21 |
* Conselleria d'Infraestructures i Transport |
|
22 |
* Av. Blasco Ib??ez, 50 |
|
23 |
* 46010 VALENCIA |
|
24 |
* SPAIN |
|
25 |
* |
|
26 |
* +34 963862235 |
|
27 |
* gvsig@gva.es |
|
28 |
* www.gvsig.gva.es |
|
29 |
* |
|
30 |
* or |
|
31 |
* |
|
32 |
* IVER T.I. S.A |
|
33 |
* Salamanca 50 |
|
34 |
* 46005 Valencia |
|
35 |
* Spain |
|
36 |
* |
|
37 |
* +34 963163400 |
|
38 |
* dac@iver.es |
|
39 |
*/ |
|
40 |
|
|
41 |
|
|
42 |
package org.cresques; |
|
43 |
|
|
44 |
import java.util.Locale; |
|
45 |
|
|
46 |
/** |
|
47 |
* Bridge class to provide internationalization services to the library. |
|
48 |
* It uses the gvsig-i18n library as a backend, and includes its |
|
49 |
* necessary initialization. |
|
50 |
* |
|
51 |
* @author Cesar Martinez Izquierdo |
|
52 |
* |
|
53 |
*/ |
|
54 |
public class Messages { |
|
55 |
/** |
|
56 |
* Whether the class has been initialized |
|
57 |
*/ |
|
58 |
private static boolean isInitialized = false; |
|
59 |
|
|
60 |
/** |
|
61 |
* The name of the Java package containing this class |
|
62 |
*/ |
|
63 |
// private static final String packageName = Messages.class.getName() ; |
|
64 |
|
|
65 |
/** |
|
66 |
* Loads the translations in the dictionary. It initializes the backend |
|
67 |
* gvsig-i18n library |
|
68 |
* |
|
69 |
*/ |
|
70 |
private static void init() { |
|
71 |
if (!org.gvsig.i18n.Messages.hasLocales()) { |
|
72 |
org.gvsig.i18n.Messages.addLocale(Locale.getDefault()); |
|
73 |
} |
|
74 |
org.gvsig.i18n.Messages.addResourceFamily("org.cresques.i18n.resources.translations.text", Messages.class.getClassLoader(), Messages.class.getClass().getName()); |
|
75 |
} |
|
76 |
|
|
77 |
/** |
|
78 |
* Gets the translation associated with the provided translation key. |
|
79 |
* |
|
80 |
* @param key The translation key which identifies the target text |
|
81 |
* @return The translation associated with the provided translation key. |
|
82 |
*/ |
|
83 |
public static String getText(String key) { |
|
84 |
if (isInitialized==false) { |
|
85 |
init(); |
|
86 |
isInitialized = true; |
|
87 |
} |
|
88 |
return org.gvsig.i18n.Messages.getText(key, Messages.class.getName()); |
|
89 |
} |
|
90 |
|
|
91 |
} |
|
92 |
|
|
0 | 93 |
tags/v_1_12_0_Build_1402/libProjection/src/org/cresques/px/PxSize.java | ||
---|---|---|
1 |
/* |
|
2 |
* Cresques Mapping Suite. Graphic Library for constructing mapping applications. |
|
3 |
* |
|
4 |
* Copyright (C) 2004-5. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
19 |
* |
|
20 |
* For more information, contact: |
|
21 |
* |
|
22 |
* cresques@gmail.com |
|
23 |
*/ |
|
24 |
package org.cresques.px; |
|
25 |
|
|
26 |
public class PxSize implements ISize { |
|
27 |
private int pw = 0; |
|
28 |
private int ph = 0; |
|
29 |
|
|
30 |
public PxSize(int w, int h) { |
|
31 |
this.pw = w; |
|
32 |
this.ph = h; |
|
33 |
} |
|
34 |
|
|
35 |
public int w() { |
|
36 |
return pw; |
|
37 |
} |
|
38 |
|
|
39 |
public int w(int w) { |
|
40 |
pw = w; |
|
41 |
|
|
42 |
return pw; |
|
43 |
} |
|
44 |
|
|
45 |
public int h() { |
|
46 |
return ph; |
|
47 |
} |
|
48 |
|
|
49 |
public int h(int h) { |
|
50 |
ph = h; |
|
51 |
|
|
52 |
return ph; |
|
53 |
} |
|
54 |
} |
|
0 | 55 |
tags/v_1_12_0_Build_1402/libProjection/src/org/cresques/px/PxObj.java | ||
---|---|---|
1 |
/* |
|
2 |
* Cresques Mapping Suite. Graphic Library for constructing mapping applications. |
|
3 |
* |
|
4 |
* Copyright (C) 2004-5. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
19 |
* |
|
20 |
* For more information, contact: |
|
21 |
* |
|
22 |
* cresques@gmail.com |
|
23 |
*/ |
|
24 |
package org.cresques.px; |
|
25 |
|
|
26 |
import java.awt.Stroke; |
|
27 |
|
|
28 |
|
|
29 |
public abstract class PxObj implements Drawable, Extent.Has { |
|
30 |
public Stroke stroke = null; |
|
31 |
/** |
|
32 |
* Extent completo del raster. Este contiene las coordenadas reales tanto |
|
33 |
* para un raster rotado como sin rotar. Este extent coincide con requestExtent |
|
34 |
* cuando el raster no tiene rotaci?n. |
|
35 |
*/ |
|
36 |
protected Extent extent = null; |
|
37 |
/** |
|
38 |
* Este es el extent sobre el que se ajusta una petici?n para que esta no exceda el |
|
39 |
* extent m?ximo del raster. Para un raster sin rotar ser? igual al extent |
|
40 |
* pero para un raster rotado ser? igual al extent del raster como si no |
|
41 |
* tuviera rotaci?n. Esto ha de ser as? ya que la rotaci?n solo se hace sobre la |
|
42 |
* vista y las peticiones han de hacerse en coordenadas de la imagen sin shearing |
|
43 |
* aplicado. |
|
44 |
*/ |
|
45 |
protected Extent requestExtent = null; |
|
46 |
|
|
47 |
public Extent getExtent() { |
|
48 |
return extent; |
|
49 |
} |
|
50 |
} |
|
0 | 51 |
tags/v_1_12_0_Build_1402/libProjection/src/org/cresques/px/ISize.java | ||
---|---|---|
1 |
/* |
|
2 |
* Cresques Mapping Suite. Graphic Library for constructing mapping applications. |
|
3 |
* |
|
4 |
* Copyright (C) 2004-5. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
19 |
* |
|
20 |
* For more information, contact: |
|
21 |
* |
|
22 |
* cresques@gmail.com |
|
23 |
*/ |
|
24 |
package org.cresques.px; |
|
25 |
|
|
26 |
public interface ISize { |
|
27 |
public int w(); |
|
28 |
|
|
29 |
public int w(int w); |
|
30 |
|
|
31 |
public int h(); |
|
32 |
|
|
33 |
public int h(int h); |
|
34 |
} |
|
0 | 35 |
tags/v_1_12_0_Build_1402/libProjection/src/org/cresques/px/PxLayer.java | ||
---|---|---|
1 |
/* |
|
2 |
* Cresques Mapping Suite. Graphic Library for constructing mapping applications. |
|
3 |
* |
|
4 |
* Copyright (C) 2004-5. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
19 |
* |
|
20 |
* For more information, contact: |
|
21 |
* |
|
22 |
* cresques@gmail.com |
|
23 |
*/ |
|
24 |
package org.cresques.px; |
|
25 |
|
|
26 |
import org.cresques.cts.IProjection; |
|
27 |
|
|
28 |
import org.cresques.geo.ViewPortData; |
|
29 |
|
|
30 |
import java.awt.Graphics2D; |
|
31 |
|
|
32 |
|
|
33 |
public class PxLayer extends PxObjList { |
|
34 |
private static int layerSeed = 0x00; |
|
35 |
protected boolean visible = true; |
|
36 |
protected String name = "Capa"; |
|
37 |
protected int id = 0; |
|
38 |
|
|
39 |
public PxLayer(String name, IProjection proj) { |
|
40 |
super(proj); |
|
41 |
id = PxLayer.layerSeed++; |
|
42 |
this.name = name; |
|
43 |
} |
|
44 |
|
|
45 |
public boolean isVisible() { |
|
46 |
return visible; |
|
47 |
} |
|
48 |
|
|
49 |
public void setVisible(boolean v) { |
|
50 |
visible = v; |
|
51 |
} |
|
52 |
|
|
53 |
public void setName(String name) { |
|
54 |
this.name = name; |
|
55 |
} |
|
56 |
|
|
57 |
public String getName() { |
|
58 |
return name; |
|
59 |
} |
|
60 |
|
|
61 |
public int getId() { |
|
62 |
return id; |
|
63 |
} |
|
64 |
|
|
65 |
// public void draw(Graphics2D g, AffineTransform mat, Extent sz) { |
|
66 |
public void draw(Graphics2D g, ViewPortData vp) { |
|
67 |
if (isVisible()) { |
|
68 |
super.draw(g, vp); |
|
69 |
} |
|
70 |
} |
|
71 |
} |
|
0 | 72 |
tags/v_1_12_0_Build_1402/libProjection/src/org/cresques/px/Colored.java | ||
---|---|---|
1 |
/* |
|
2 |
* Cresques Mapping Suite. Graphic Library for constructing mapping applications. |
|
3 |
* |
|
4 |
* Copyright (C) 2004-5. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
19 |
* |
|
20 |
* For more information, contact: |
|
21 |
* |
|
22 |
* cresques@gmail.com |
|
23 |
*/ |
|
24 |
package org.cresques.px; |
|
25 |
|
|
26 |
import java.awt.Color; |
|
27 |
|
|
28 |
|
|
29 |
public interface Colored { |
|
30 |
public Color c(); |
|
31 |
|
|
32 |
public Color c(Color c); |
|
33 |
} |
|
0 | 34 |
tags/v_1_12_0_Build_1402/libProjection/src/org/cresques/px/.cvsignore | ||
---|---|---|
1 |
*.dfPackage |
|
2 |
*.wmf |
|
0 | 3 |
tags/v_1_12_0_Build_1402/libProjection/src/org/cresques/px/PxLine.java | ||
---|---|---|
1 |
/* |
|
2 |
* Cresques Mapping Suite. Graphic Library for constructing mapping applications. |
|
3 |
* |
|
4 |
* Copyright (C) 2004-5. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
19 |
* |
|
20 |
* For more information, contact: |
|
21 |
* |
|
22 |
* cresques@gmail.com |
|
23 |
*/ |
|
24 |
package org.cresques.px; |
|
25 |
|
|
26 |
import org.cresques.geo.ViewPortData; |
|
27 |
|
|
28 |
import java.awt.Color; |
|
29 |
import java.awt.Graphics2D; |
|
30 |
import java.awt.Stroke; |
|
31 |
import java.awt.geom.AffineTransform; |
|
32 |
|
|
33 |
|
|
34 |
public class PxLine extends PxObj implements IPoint, Colored { |
|
35 |
private int px = 0; |
|
36 |
private int py = 0; |
|
37 |
private int px2 = 0; |
|
38 |
private int py2 = 0; |
|
39 |
private Color pc; |
|
40 |
|
|
41 |
public PxLine(IPoint p, IPoint p2, Color color) { |
|
42 |
x(p.x()); |
|
43 |
y(p.y()); |
|
44 |
x2(p2.x()); |
|
45 |
y2(p2.y()); |
|
46 |
c(color); |
|
47 |
extent = new Extent(Math.min(x(), x2()), Math.min(y(), y2()), |
|
48 |
Math.max(x(), x2()), Math.max(y(), y2())); |
|
49 |
} |
|
50 |
|
|
51 |
public PxLine(int x, int y, int x2, int y2, Color color) { |
|
52 |
x(x); |
|
53 |
y(y); |
|
54 |
x2(x2); |
|
55 |
y2(y2); |
|
56 |
c(color); |
|
57 |
extent = new Extent(Math.min(x(), x2()), Math.min(y(), y2()), |
|
58 |
Math.max(x(), x2()), Math.max(y(), y2())); |
|
59 |
} |
|
60 |
|
|
61 |
public int x() { |
|
62 |
return px; |
|
63 |
} |
|
64 |
|
|
65 |
public int x(int x) { |
|
66 |
px = x; |
|
67 |
|
|
68 |
return px; |
|
69 |
} |
|
70 |
|
|
71 |
public int y() { |
|
72 |
return py; |
|
73 |
} |
|
74 |
|
|
75 |
public int y(int y) { |
|
76 |
py = y; |
|
77 |
|
|
78 |
return py; |
|
79 |
} |
|
80 |
|
|
81 |
public int x2() { |
|
82 |
return px2; |
|
83 |
} |
|
84 |
|
|
85 |
public int x2(int x) { |
|
86 |
px2 = x; |
|
87 |
|
|
88 |
return px2; |
|
89 |
} |
|
90 |
|
|
91 |
public int y2() { |
|
92 |
return py2; |
|
93 |
} |
|
94 |
|
|
95 |
public int y2(int y) { |
|
96 |
py2 = y; |
|
97 |
|
|
98 |
return py2; |
|
99 |
} |
|
100 |
|
|
101 |
public Color c() { |
|
102 |
return pc; |
|
103 |
} |
|
104 |
|
|
105 |
public Color c(Color color) { |
|
106 |
pc = color; |
|
107 |
|
|
108 |
return pc; |
|
109 |
} |
|
110 |
|
|
111 |
public void setStroke(Stroke stroke) { |
|
112 |
this.stroke = stroke; |
|
113 |
} |
|
114 |
|
|
115 |
/* public void draw(Graphics2D g) { |
|
116 |
draw(g, g.getTransform(), null); |
|
117 |
} |
|
118 |
|
|
119 |
public void draw(Graphics2D g, AffineTransform mat, Extent sz) { |
|
120 |
*/ |
|
121 |
public void draw(Graphics2D g, ViewPortData vp) { |
|
122 |
Stroke strkSave = null; |
|
123 |
|
|
124 |
if (stroke != null) { |
|
125 |
strkSave = g.getStroke(); |
|
126 |
g.setStroke(stroke); |
|
127 |
} |
|
128 |
|
|
129 |
AffineTransform msave = g.getTransform(); |
|
130 |
g.setTransform(vp.mat); |
|
131 |
g.setColor(c()); |
|
132 |
g.drawLine(x(), y(), x2(), y2()); |
|
133 |
|
|
134 |
if (strkSave != null) { |
|
135 |
g.setStroke(strkSave); |
|
136 |
} |
|
137 |
|
|
138 |
g.setTransform(msave); |
|
139 |
} |
|
140 |
} |
|
0 | 141 |
tags/v_1_12_0_Build_1402/libProjection/src/org/cresques/px/PxContour.java | ||
---|---|---|
1 |
/* |
|
2 |
* Cresques Mapping Suite. Graphic Library for constructing mapping applications. |
|
3 |
* |
|
4 |
* Copyright (C) 2004-5. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
19 |
* |
|
20 |
* For more information, contact: |
|
21 |
* |
|
22 |
* cresques@gmail.com |
|
23 |
*/ |
|
24 |
package org.cresques.px; |
|
25 |
|
|
26 |
import org.cresques.cts.ICoordTrans; |
|
27 |
import org.cresques.cts.IProjection; |
|
28 |
|
|
29 |
import org.cresques.geo.Polygon2D; |
|
30 |
import org.cresques.geo.Projected; |
|
31 |
import org.cresques.geo.ViewPortData; |
|
32 |
import org.cresques.geo.cover.Hoja; |
|
33 |
|
|
34 |
import java.awt.Color; |
|
35 |
import java.awt.FontMetrics; |
|
36 |
import java.awt.Graphics2D; |
|
37 |
import java.awt.geom.Point2D; |
|
38 |
|
|
39 |
import java.util.Vector; |
|
40 |
|
|
41 |
|
|
42 |
public class PxContour extends PxObj implements Projected { |
|
43 |
final static Color colorBase = new Color(0, 64, 128, 255); //Color(255,214,132,255); |
|
44 |
final static Color fColorBase = new Color(64, 128, 192, 255); //Color(255,222,165,64); |
|
45 |
IProjection proj = null; |
|
46 |
protected String name; |
|
47 |
protected String fName; |
|
48 |
private Color fColor = fColorBase; |
|
49 |
private Color pc = colorBase; |
|
50 |
private Polygon2D polygon = null; |
|
51 |
|
|
52 |
public PxContour(Extent e, String fName, String name, IProjection proj) { |
|
53 |
this.fName = fName; |
|
54 |
this.name = name; |
|
55 |
this.proj = proj; |
|
56 |
|
|
57 |
Point2D[] v = new Point2D[4]; |
|
58 |
v[0] = proj.createPoint(e.minX(), e.minY()); |
|
59 |
v[1] = proj.createPoint(e.maxX(), e.minY()); |
|
60 |
v[2] = proj.createPoint(e.maxX(), e.maxY()); |
|
61 |
v[3] = proj.createPoint(e.minX(), e.maxY()); |
|
62 |
setContour(v); |
|
63 |
} |
|
64 |
|
|
65 |
public PxContour(Hoja h) { |
|
66 |
name = h.getCode(); |
|
67 |
setContour(h.getVertex()); |
|
68 |
} |
|
69 |
|
|
70 |
public PxContour(Point2D[] v, String name) { |
|
71 |
this.name = name; |
|
72 |
setContour(v); |
|
73 |
} |
|
74 |
|
|
75 |
public void _PxContour(Point2D pt1, Point2D pt2, String fName, String name) { |
|
76 |
this.fName = fName; |
|
77 |
this.name = name; |
|
78 |
extent = new Extent(pt1, pt2); |
|
79 |
} |
|
80 |
|
|
81 |
public void _PxContour(Point2D[] v, String fName, String name) { |
|
82 |
this.fName = fName; |
|
83 |
this.name = name; |
|
84 |
setContour(v); |
|
85 |
} |
|
86 |
|
|
87 |
public IProjection getProjection() { |
|
88 |
return proj; |
|
89 |
} |
|
90 |
|
|
91 |
public void setProjection(IProjection p) { |
|
92 |
proj = p; |
|
93 |
} |
|
94 |
|
|
95 |
private void setContour(Point2D[] v) { |
|
96 |
extent = new Extent(); |
|
97 |
polygon = new Polygon2D(); |
|
98 |
|
|
99 |
for (int i = 0; i < v.length; i++) { |
|
100 |
polygon.addPoint(v[i]); |
|
101 |
extent.add(v[i]); |
|
102 |
} |
|
103 |
} |
|
104 |
|
|
105 |
/** |
|
106 |
* Vertices de un contorno. |
|
107 |
* @return |
|
108 |
*/ |
|
109 |
public Vector getVertex() { |
|
110 |
return polygon; |
|
111 |
} |
|
112 |
|
|
113 |
public Point2D[] getPtList() { |
|
114 |
Point2D[] v = new Point2D[polygon.size()]; |
|
115 |
|
|
116 |
for (int i = 0; i < polygon.size(); i++) |
|
117 |
v[i] = (Point2D) polygon.get(i); |
|
118 |
|
|
119 |
return v; |
|
120 |
} |
|
121 |
|
|
122 |
public String getName() { |
|
123 |
return name; |
|
124 |
} |
|
125 |
|
|
126 |
public Color c() { |
|
127 |
return pc; |
|
128 |
} |
|
129 |
|
|
130 |
public Color c(Color color) { |
|
131 |
this.pc = color; |
|
132 |
|
|
133 |
return pc; |
|
134 |
} |
|
135 |
|
|
136 |
public Color fillColor() { |
|
137 |
return fColor; |
|
138 |
} |
|
139 |
|
|
140 |
public Color fillColor(Color c) { |
|
141 |
fColor = c; |
|
142 |
|
|
143 |
return fColor; |
|
144 |
} |
|
145 |
|
|
146 |
public void setColor(Color color) { |
|
147 |
pc = color; |
|
148 |
} |
|
149 |
|
|
150 |
public Color getColor() { |
|
151 |
return pc; |
|
152 |
} |
|
153 |
|
|
154 |
public void setFillColor(Color color) { |
|
155 |
fColor = color; |
|
156 |
} |
|
157 |
|
|
158 |
public Color getFillColor() { |
|
159 |
return fColor; |
|
160 |
} |
|
161 |
|
|
162 |
public void reProject(ICoordTrans rp) { |
|
163 |
Polygon2D savePol = polygon; |
|
164 |
|
|
165 |
polygon = new Polygon2D(); |
|
166 |
extent = new Extent(); |
|
167 |
|
|
168 |
Point2D ptDest = null; |
|
169 |
|
|
170 |
for (int i = 0; i < savePol.size(); i++) { |
|
171 |
ptDest = rp.getPDest().createPoint(0.0, 0.0); |
|
172 |
ptDest = rp.convert((Point2D) savePol.get(i), ptDest); |
|
173 |
polygon.addPoint(ptDest); |
|
174 |
extent.add(ptDest); |
|
175 |
} |
|
176 |
|
|
177 |
setProjection(rp.getPDest()); |
|
178 |
} |
|
179 |
|
|
180 |
public void draw(Graphics2D g, ViewPortData vp, ICoordTrans rp) { |
|
181 |
IProjection saveProj = proj; |
|
182 |
Polygon2D savePol = polygon; |
|
183 |
Extent saveExt = extent; |
|
184 |
|
|
185 |
reProject(rp); |
|
186 |
draw(g, vp); |
|
187 |
|
|
188 |
polygon = savePol; |
|
189 |
extent = saveExt; |
|
190 |
proj = saveProj; |
|
191 |
} |
|
192 |
|
|
193 |
public void draw(Graphics2D g, ViewPortData vp) { |
|
194 |
//AffineTransform msave=g.getTransform(); |
|
195 |
//g.setTransform(vp.mat); |
|
196 |
// relleno el marco si es preciso |
|
197 |
if (fColor != null) { |
|
198 |
g.setColor(fColor); |
|
199 |
|
|
200 |
if (polygon == null) { |
|
201 |
g.fillRect((int) extent.minX(), (int) extent.minY(), |
|
202 |
(int) extent.width(), (int) extent.height()); |
|
203 |
} else { |
|
204 |
polygon.fill(g, vp); |
|
205 |
} |
|
206 |
} |
|
207 |
|
|
208 |
// pinto el marco si es preciso |
|
209 |
if (pc != null) { |
|
210 |
g.setColor(pc); |
|
211 |
} |
|
212 |
|
|
213 |
if (polygon != null) { |
|
214 |
polygon.draw(g, vp); |
|
215 |
} else { |
|
216 |
g.drawRect((int) extent.minX(), (int) extent.minY(), |
|
217 |
(int) extent.width(), (int) extent.height()); |
|
218 |
} |
|
219 |
|
|
220 |
//g.setTransform(msave); |
|
221 |
// Pinto el name |
|
222 |
FontMetrics fm = g.getFontMetrics(); |
|
223 |
int w = fm.stringWidth(name); |
|
224 |
int h = fm.getAscent(); |
|
225 |
Point2D.Double pt = new Point2D.Double((extent.minX() + |
|
226 |
(extent.width() / 2.0)), |
|
227 |
(extent.minY() + |
|
228 |
(extent.height() / 2.0))); |
|
229 |
|
|
230 |
try { |
|
231 |
Point2D.Double min = new Point2D.Double(extent.minX(), extent.minY()); |
|
232 |
Point2D.Double max = new Point2D.Double(extent.maxX(), extent.minY()); |
|
233 |
vp.mat.transform(min, min); |
|
234 |
vp.mat.transform(max, max); |
|
235 |
|
|
236 |
if ((max.getX() - min.getX()) < w) { |
|
237 |
return; |
|
238 |
} |
|
239 |
|
|
240 |
vp.mat.transform(pt, pt); |
|
241 |
|
|
242 |
//if ((int)(pt2.getY()-pt1.getY()) >= g.getFontMetrics().getAscent()) |
|
243 |
g.drawString(name, (int) pt.getX() - (w / 2), |
|
244 |
(int) pt.getY() + (h / 2)); |
|
245 |
} catch (Exception e) { |
|
246 |
e.printStackTrace(); |
|
247 |
} |
|
248 |
} |
|
249 |
} |
|
0 | 250 |
tags/v_1_12_0_Build_1402/libProjection/src/org/cresques/px/PxPoint.java | ||
---|---|---|
1 |
/* |
|
2 |
* Cresques Mapping Suite. Graphic Library for constructing mapping applications. |
|
3 |
* |
|
4 |
* Copyright (C) 2004-5. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
19 |
* |
|
20 |
* For more information, contact: |
|
21 |
* |
|
22 |
* cresques@gmail.com |
|
23 |
*/ |
|
24 |
package org.cresques.px; |
|
25 |
|
|
26 |
public class PxPoint implements IPoint { |
|
27 |
private int px = 0; |
|
28 |
private int py = 0; |
|
29 |
|
|
30 |
public PxPoint(int x, int y) { |
|
31 |
this.px = x; |
|
32 |
this.py = y; |
|
33 |
} |
|
34 |
|
|
35 |
public int x() { |
|
36 |
return px; |
|
37 |
} |
|
38 |
|
|
39 |
public int x(int x) { |
|
40 |
px = x; |
|
41 |
|
|
42 |
return px; |
|
43 |
} |
|
44 |
|
|
45 |
public int y() { |
|
46 |
return py; |
|
47 |
} |
|
48 |
|
|
49 |
public int y(int y) { |
|
50 |
py = y; |
|
51 |
|
|
52 |
return py; |
|
53 |
} |
|
54 |
} |
|
0 | 55 |
tags/v_1_12_0_Build_1402/libProjection/src/org/cresques/px/IPoint.java | ||
---|---|---|
1 |
/* |
|
2 |
* Cresques Mapping Suite. Graphic Library for constructing mapping applications. |
|
3 |
* |
|
4 |
* Copyright (C) 2004-5. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
19 |
* |
|
20 |
* For more information, contact: |
|
21 |
* |
|
22 |
* cresques@gmail.com |
|
23 |
*/ |
|
24 |
package org.cresques.px; |
|
25 |
|
|
26 |
public interface IPoint { |
|
27 |
public int x(); |
|
28 |
|
|
29 |
public int x(int x); |
|
30 |
|
|
31 |
public int y(); |
|
32 |
|
|
33 |
public int y(int y); |
|
34 |
} |
|
0 | 35 |
tags/v_1_12_0_Build_1402/libProjection/src/org/cresques/px/PxRect.java | ||
---|---|---|
1 |
/* |
|
2 |
* Cresques Mapping Suite. Graphic Library for constructing mapping applications. |
|
3 |
* |
|
4 |
* Copyright (C) 2004-5. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
19 |
* |
|
20 |
* For more information, contact: |
|
21 |
* |
|
22 |
* cresques@gmail.com |
|
23 |
*/ |
|
24 |
package org.cresques.px; |
|
25 |
|
|
26 |
import org.cresques.geo.ViewPortData; |
|
27 |
|
|
28 |
import java.awt.Color; |
|
29 |
import java.awt.Graphics2D; |
|
30 |
import java.awt.geom.AffineTransform; |
|
31 |
|
|
32 |
|
|
33 |
public class PxRect extends PxObj implements IPoint, ISize, Colored { |
|
34 |
private int px = 0; |
|
35 |
private int py = 0; |
|
36 |
private int pw = 0; |
|
37 |
private int ph = 0; |
|
38 |
private Color pc; |
|
39 |
private Color filColor = null; |
|
40 |
|
|
41 |
public PxRect(IPoint p, ISize s, Color color, Color fc) { |
|
42 |
x(p.x()); |
|
43 |
y(p.y()); |
|
44 |
w(s.w()); |
|
45 |
h(s.h()); |
|
46 |
c(color); |
|
47 |
fillColor(fc); |
|
48 |
extent = new Extent(x(), y(), x() + w(), y() + h()); |
|
49 |
} |
|
50 |
|
|
51 |
public PxRect(int x, int y, int w, int h, Color color, Color fc) { |
|
52 |
x(x); |
|
53 |
y(y); |
|
54 |
w(w); |
|
55 |
h(h); |
Also available in: Unified diff