Revision 9332

View differences:

org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2
  <modelVersion>4.0.0</modelVersion>
3
  <groupId>org.gvsig</groupId>
4
  <artifactId>org.gvsig.legend.picturemarkersymboltable</artifactId>
5
  <version>1.0.38</version>
6
  <packaging>pom</packaging>
7
  <name>${project.artifactId}</name>
8
  <description>Legend for urban horizontal signage.</description>
9
  <parent>
10
    <groupId>org.gvsig</groupId>
11
    <artifactId>org.gvsig.desktop</artifactId>
12
    <version>2.0.425</version>
13
  </parent>
14

  
15
  <url>https://devel.gvsig.org/sites/org.gvsig.legend.picturemarkersymboltable/${project.version}</url>
16
  <scm>
17
    <connection>scm:svn:https://devel.gvsig.org/svn/gvsig-base-legends/org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38</connection>
18
    <developerConnection>scm:svn:https://devel.gvsig.org/svn/gvsig-base-legends/org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38</developerConnection>
19
    <url>https://devel.gvsig.org/redmine/projects/gvsig-base-legends/repository/show/org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38</url>
20
  </scm>
21
  <repositories>
22
    <repository>
23
      <id>gvsig-public-http-repository</id>
24
      <name>gvSIG maven public HTTP repository</name>
25
      <url>http://devel.gvsig.org/m2repo/j2se</url>
26
      <releases>
27
        <enabled>true</enabled>
28
        <updatePolicy>daily</updatePolicy>
29
        <checksumPolicy>warn</checksumPolicy>
30
      </releases>
31
      <snapshots>
32
        <enabled>true</enabled>
33
        <updatePolicy>daily</updatePolicy>
34
        <checksumPolicy>warn</checksumPolicy>
35
      </snapshots>
36
    </repository>
37
  </repositories>
38

  
39
  <distributionManagement>
40
    <site>
41
      <id>gvsig-repository</id>
42
      <url>dav:https://devel.gvsig.org/download/projects/gvsig-base-legends/pool/${project.artifactId}/${project.version}</url>
43
    </site>
44
  </distributionManagement>
45

  
46
  <build>
47
    <plugins>
48
      <plugin>
49
        <groupId>org.apache.maven.plugins</groupId>
50
        <artifactId>maven-release-plugin</artifactId>
51
        <configuration>
52
          <tagBase>https://devel.gvsig.org/svn/gvsig-base-legends/org.gvsig.legend.picturemarkersymboltable/tags</tagBase>
53
        </configuration>
54
      </plugin>
55
    </plugins>
56
  </build>
57

  
58

  
59

  
60
  <dependencyManagement>
61
    <dependencies>
62
      <dependency>
63
        <groupId>org.gvsig</groupId>
64
        <artifactId>org.gvsig.legend.picturemarkersymboltable.lib.api</artifactId>
65
        <version>1.0.38</version>
66
      </dependency>
67
      <dependency>
68
        <groupId>org.gvsig</groupId>
69
        <artifactId>org.gvsig.legend.picturemarkersymboltable.lib.impl</artifactId>
70
        <version>1.0.38</version>
71
      </dependency>
72
      <dependency>
73
        <groupId>org.gvsig</groupId>
74
        <artifactId>org.gvsig.legend.picturemarkersymboltable.swing.api</artifactId>
75
        <version>1.0.38</version>
76
      </dependency>
77
      <dependency>
78
        <groupId>org.gvsig</groupId>
79
        <artifactId>org.gvsig.legend.picturemarkersymboltable.swing.impl</artifactId>
80
        <version>1.0.38</version>
81
      </dependency>
82
      <dependency>
83
        <groupId>org.gvsig</groupId>
84
        <artifactId>org.gvsig.legend.picturemarkersymboltable.app.mainplugin</artifactId>
85
        <version>1.0.38</version>
86
      </dependency>
87
    </dependencies>
88
  </dependencyManagement>
89
  <modules>
90
    <module>org.gvsig.legend.picturemarkersymboltable.lib</module>
91
    <module>org.gvsig.legend.picturemarkersymboltable.swing</module>
92
    <module>org.gvsig.legend.picturemarkersymboltable.app</module>
93
  </modules>
94
</project>
org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38/org.gvsig.legend.picturemarkersymboltable.app/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2
  <modelVersion>4.0.0</modelVersion>
3
  <parent>
4
    <groupId>org.gvsig</groupId>
5
    <artifactId>org.gvsig.legend.picturemarkersymboltable</artifactId>
6
    <version>1.0.38</version>
7
  </parent>
8
  <groupId>org.gvsig</groupId>
9
  <artifactId>org.gvsig.legend.picturemarkersymboltable.app</artifactId>
10
  <packaging>pom</packaging>
11
  <name>org.gvsig.legend.picturemarkersymboltable.app</name>
12

  
13
  <modules>
14
    <module>org.gvsig.legend.picturemarkersymboltable.app.mainplugin</module>
15
  </modules>
16

  
17
</project>
org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38/org.gvsig.legend.picturemarkersymboltable.app/org.gvsig.legend.picturemarkersymboltable.app.mainplugin/buildNumber.properties
1
#Sun Jul 09 18:15:54 CEST 2023
2
buildNumber=40
org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38/org.gvsig.legend.picturemarkersymboltable.app/org.gvsig.legend.picturemarkersymboltable.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml
1
<!-- gvSIG. Desktop Geographic Information System. Copyright (C) 2007-2013 gvSIG
2
  Association. This program is free software; you can redistribute it and/or modify
3
  it under the terms of the GNU General Public License as published by the Free Software
4
  Foundation; either version 3 of the License, or (at your option) any later version.
5
  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
6
  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
7
  PURPOSE. See the GNU General Public License for more details. You should have received
8
  a copy of the GNU General Public License along with this program; if not, write to
9
  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
10
  USA. For any additional information, do not hesitate to contact us at info AT gvsig.com,
11
  or visit our website www.gvsig.com. -->
12
<assembly>
13
  <id>gvsig-plugin-package</id>
14
  <formats>
15
    <format>zip</format>
16
  </formats>
17
  <baseDirectory>${project.artifactId}</baseDirectory>
18
  <includeBaseDirectory>true</includeBaseDirectory>
19
  <files>
20
    <file>
21
      <source>target/${project.artifactId}-${project.version}.jar</source>
22
      <outputDirectory>lib</outputDirectory>
23
    </file>
24
    <file>
25
      <source>target/package.info</source>
26
    </file>
27
  </files>
28

  
29
  <fileSets>
30
    <fileSet>
31
      <directory>src/main/resources-plugin</directory>
32
      <outputDirectory>.</outputDirectory>
33
    </fileSet>
34
  </fileSets>
35

  
36

  
37
  <dependencySets>
38
    <dependencySet>
39
      <useProjectArtifact>false</useProjectArtifact>
40
      <useTransitiveDependencies>false</useTransitiveDependencies>
41
      <outputDirectory>lib</outputDirectory>
42
      <includes>
43
        <include>org.gvsig:org.gvsig.legend.picturemarkersymboltable.lib.api</include>
44
        <include>org.gvsig:org.gvsig.legend.picturemarkersymboltable.lib.impl</include>
45
        <include>org.gvsig:org.gvsig.legend.picturemarkersymboltable.swing.api</include>
46
        <include>org.gvsig:org.gvsig.legend.picturemarkersymboltable.swing.impl</include>
47
      </includes>
48
    </dependencySet>
49
  </dependencySets>
50

  
51
</assembly>
52

  
org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38/org.gvsig.legend.picturemarkersymboltable.app/org.gvsig.legend.picturemarkersymboltable.app.mainplugin/src/main/resources-plugin/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<!-- gvSIG. Desktop Geographic Information System. Copyright (C) 2007-2013 gvSIG
3
  Association. This program is free software; you can redistribute it and/or modify
4
  it under the terms of the GNU General Public License as published by the Free Software
5
  Foundation; either version 3 of the License, or (at your option) any later version.
6
  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
7
  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8
  PURPOSE. See the GNU General Public License for more details. You should have received
9
  a copy of the GNU General Public License along with this program; if not, write to
10
  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
11
  USA. For any additional information, do not hesitate to contact us at info AT gvsig.com,
12
  or visit our website www.gvsig.com. -->
13
<plugin-config>
14
  <depends plugin-name="org.gvsig.app.mainplugin" />
15
  <resourceBundle name="text" />
16
  <libraries library-dir="lib" />
17
  <extensions>
18
      <extension class-name="org.gvsig.andami.LibraryExtension"
19
                 description="" active="true" priority="1">
20
      </extension>
21

  
22
  </extensions>
23
</plugin-config>
org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38/org.gvsig.legend.picturemarkersymboltable.app/org.gvsig.legend.picturemarkersymboltable.app.mainplugin/src/main/resources-plugin/plugin-persistence.def
1
<?xml version="1.0"?>
2
<!--
3
Definitions of plugin persistence org.gvsig.legend.picturemarkersymboltable.app.mainplugin
4
 -->
5
<definitions>
6
  <version>1.0.0</version>
7
  <classes>
8
    <class name="org.gvsig.legend.picturemarkersymboltable.app.mainplugin">
9
      <extends>
10
      </extends>
11
      <description>Persistence of the legend of picture marker symbols in a table</description>
12
      <fields>
13
      </fields>
14
    </class>
15
  </classes>
16
</definitions>  
org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38/org.gvsig.legend.picturemarkersymboltable.app/org.gvsig.legend.picturemarkersymboltable.app.mainplugin/src/main/resources-plugin/i18n/text.properties
1

  
2
# ---------------------------------------
3
# Picture marker symbol table legend
4
#
5
_Picture_marker_symbol_table_legend=Valores \u00fanicos de marcador de imagen en tabla
6
_Legend_table_fields=Campos de la tabla de la leyenda
7
_Images_table_fields=Campos de la tabla de las imagenes
8
_Unit=Unidad
9
_Line_to_offset_color=Color de la linea al offset
10
_Draw_line_to_offset=Pinta la linea al offset
11
_Classifying_field=Campo para clasificar
12
_OffsetX_field=Campo para el offset X
13
_OffsetY_field=Campo para el offset Y
14
_Rotation_field=Campo para la rotaci\u00f3n
15
_Line_to_offset_color_field=Campo para el color de la linea al offset
16
_Table_name=Nombre de tabla
17
_Image_field=Campo de la imagen
18
_Image_selected_field=Campo de la imagen seleccionada
19

  
20

  
21

  
org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38/org.gvsig.legend.picturemarkersymboltable.app/org.gvsig.legend.picturemarkersymboltable.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties
1

  
2
# ---------------------------------------
3
# Picture marker symbol table legend
4
#
5
_Picture_marker_symbol_table_legend=Picture marker unique values in table
6
_Legend_table_fields=Legend table fields
7
_Images_table_fields=Images table fields
8
_Unit=Unit
9
_Line_to_offset_color=Line to offset color
10
_Draw_line_to_offset=Draw line to offset
11
_Classifying_field=Classifying field
12
_OffsetX_field=OffsetX field
13
_OffsetY_field=OffsetY field
14
_Rotation_field=Rotation field
15
_Line_to_offset_color_field=Line to offset color field
16
_Table_name=Table name
17
_Image_field=Image field
18
_Image_selected_field=Image selected field
19

  
org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38/org.gvsig.legend.picturemarkersymboltable.app/org.gvsig.legend.picturemarkersymboltable.app.mainplugin/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2
  <modelVersion>4.0.0</modelVersion>
3
  <parent>
4
    <groupId>org.gvsig</groupId>
5
    <artifactId>org.gvsig.legend.picturemarkersymboltable.app</artifactId>
6
    <version>1.0.38</version>
7
  </parent>
8
  <groupId>org.gvsig</groupId>
9
  <artifactId>org.gvsig.legend.picturemarkersymboltable.app.mainplugin</artifactId>
10
  <version>1.0.38</version>
11
  <name>org.gvsig.legend.picturemarkersymboltable.app.mainplugin</name>
12

  
13
    <properties>
14
    <!-- Package info property values -->
15
    <gvsig.package.info.state>testing</gvsig.package.info.state>
16
    <gvsig.package.info.dependencies>required: org.gvsig.app.mainplugin -ge 2.6.0-A</gvsig.package.info.dependencies>
17
    <gvsig.package.info.official>true</gvsig.package.info.official>
18
    <gvsig.package.info.name>Vector legend: Picture marker symbols in a table</gvsig.package.info.name>
19
    <gvsig.package.info.description>Legend for work with picture marker symbols in a table.</gvsig.package.info.description>
20
    <gvsig.package.info.categories>View,Vector,Symbology</gvsig.package.info.categories>
21
    <gvsig.package.info.javaVM>j1_8</gvsig.package.info.javaVM>
22
    <gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-base-legends/pool</gvsig.package.info.poolURL>
23
  </properties>
24

  
25
  <dependencies>
26
    <dependency>
27
      <groupId>org.gvsig</groupId>
28
      <artifactId>org.gvsig.andami</artifactId>
29
      <scope>compile</scope>
30
    </dependency>
31
    <dependency>
32
      <groupId>org.gvsig</groupId>
33
      <artifactId>org.gvsig.legend.picturemarkersymboltable.swing.api</artifactId>
34
      <scope>compile</scope>
35
    </dependency>
36
    <dependency>
37
      <groupId>org.gvsig</groupId>
38
      <artifactId>org.gvsig.legend.picturemarkersymboltable.lib.api</artifactId>
39
      <scope>compile</scope>
40
    </dependency>
41
    <dependency>
42
      <groupId>org.gvsig</groupId>
43
      <artifactId>org.gvsig.legend.picturemarkersymboltable.lib.impl</artifactId>
44
      <scope>runtime</scope>
45
    </dependency>
46
    <dependency>
47
      <groupId>org.gvsig</groupId>
48
      <artifactId>org.gvsig.legend.picturemarkersymboltable.swing.impl</artifactId>
49
      <scope>runtime</scope>
50
    </dependency>
51
    <dependency>
52
      <groupId>org.gvsig</groupId>
53
      <artifactId>org.gvsig.app.mainplugin</artifactId>
54
      <scope>compile</scope>
55
    </dependency>
56
  </dependencies>
57
</project>
org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38/org.gvsig.legend.picturemarkersymboltable.lib/org.gvsig.legend.picturemarkersymboltable.lib.api/src/main/resources/META-INF/services/org.gvsig.tools.library.Library
1
org.gvsig.legend.picturemarkersymboltable.lib.api.PictureMarkerSymbolTableLibrary
org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38/org.gvsig.legend.picturemarkersymboltable.lib/org.gvsig.legend.picturemarkersymboltable.lib.api/src/main/java/org/gvsig/legend/picturemarkersymboltable/lib/api/PictureMarkerSymbolTableManager.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 3
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.legend.picturemarkersymboltable.lib.api;
24

  
25

  
26
public interface PictureMarkerSymbolTableManager {
27

  
28
    public PictureMarkerSymbolTableLegend createPictureMarkerSymbolTableLegend();
29

  
30
    public Class<? extends PictureMarkerSymbolTableLegend> getPictureMarkerSymbolTableLegendClass();
31

  
32
}
org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38/org.gvsig.legend.picturemarkersymboltable.lib/org.gvsig.legend.picturemarkersymboltable.lib.api/src/main/java/org/gvsig/legend/picturemarkersymboltable/lib/api/PictureMarkerSymbolTableLegend.java
1
package org.gvsig.legend.picturemarkersymboltable.lib.api;
2

  
3
import java.awt.Color;
4
import org.gvsig.fmap.mapcontext.rendering.legend.IClassifiedLegend;
5
import org.gvsig.fmap.mapcontext.rendering.legend.ISingleSymbolLegend;
6
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend;
7

  
8
public interface PictureMarkerSymbolTableLegend 
9
        extends IVectorLegend, IClassifiedLegend, ISingleSymbolLegend 
10
    {
11
    
12
    public static final int DEFAULT_IMAGE_SIZE = 15;
13

  
14
    public double getImageSize();
15
    
16
    public int getUnits();
17

  
18
    public boolean isDrawLineToOffset();
19

  
20
    public Color getDefaultLineToOffsetColor();
21

  
22

  
23
    public String getClassifyingFieldName();
24

  
25
    public String getOffsetXFieldName();
26

  
27
    public String getOffsetYFieldName();
28

  
29
    public String getRotationFieldName();
30

  
31
    public String getLineToOffsetColorFieldName();
32

  
33

  
34

  
35
    public String getImagesTableName();
36

  
37
    public String getImageFieldName();
38

  
39
    public String getImageSelectedFieldName();
40

  
41
    public String getImagesTableClassifyingFieldName();
42

  
43
    public double getScale();
44

  
45

  
46
    public void setImageSize(double size);
47

  
48
    public void setUnits(int unit);
49
    
50
    public void setDefaultLineToOffsetColor(Color color);
51

  
52
    public void setDrawLineToOffset(boolean drawLineToOffset);
53

  
54
    
55

  
56
    public void setLineToOffsetColorFieldName(String fieldName);
57

  
58
    public void setOffsetXFieldName(String fieldName);
59

  
60
    public void setOffsetYFieldName(String fieldName);
61

  
62
    public void setRotationFieldName(String fieldName);
63

  
64
    public void setClassifyingFieldName(String classifyingFieldName);
65

  
66
    
67

  
68
    public void setImagesTableName(String imagesTableName);
69

  
70
    public void setImageFieldName(String imageFieldName);
71

  
72
    public void setImageSelectedFieldName(String imageSelectedFieldName);
73

  
74
    public void setImagesTableClassifyingFieldName(String imagesTableClassifyingFieldName);
75

  
76
    public void setScale(double scale);
77
    
78
    public void setReverseDirectionOfAngle(boolean reverse);
79
    
80
    public boolean isReverseDirectionOfAngle();
81
}
org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38/org.gvsig.legend.picturemarkersymboltable.lib/org.gvsig.legend.picturemarkersymboltable.lib.api/src/main/java/org/gvsig/legend/picturemarkersymboltable/lib/api/PictureMarkerSymbolTableLocator.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.legend.picturemarkersymboltable.lib.api;
24

  
25
import org.gvsig.tools.locator.AbstractLocator;
26
import org.gvsig.tools.locator.Locator;
27
import org.gvsig.tools.locator.LocatorException;
28

  
29

  
30
public class PictureMarkerSymbolTableLocator extends AbstractLocator {
31

  
32
    /**
33
     * HeatmapLegend locator name
34
     */
35
    private static final String LOCATOR_NAME = "PictureMarkerSymbolTableLocator";
36

  
37
    /**
38
     * HeatmapLegend manager name
39
     */
40
    public static final String MANAGER_NAME = "PictureMarkerSymbolTableManager";
41

  
42
    /**
43
     * HeatmapLegend manager description
44
     */
45
    private static final String MANAGER_DESCRIPTION =
46
        "PictureMarkerSymbolTable Manager of gvSIG";
47

  
48

  
49
    /**
50
     * Unique instance
51
     */
52
    private static final PictureMarkerSymbolTableLocator instance = new PictureMarkerSymbolTableLocator();
53

  
54
    @Override
55
    public String getLocatorName() {
56
        return LOCATOR_NAME;
57
    }
58

  
59
    /**
60
     * Registers the Class implementing the UrbanHorizontalSignageManager interface.
61
     *
62
     * @param clazz
63
     *            implementing the UrbanHorizontalSignageManager interface
64
     */
65
    public static void registerPictureMarkerSymbolTableManager(Class clazz){
66
        getInstance().register(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
67
    }
68

  
69
    public static void registerDefaultPictureMarkerSymbolTableManager(Class clazz){
70
        getInstance().registerDefault(MANAGER_NAME, MANAGER_DESCRIPTION, clazz);
71
    }
72

  
73
    public static PictureMarkerSymbolTableManager getPictureMarkerSymbolTableManager() throws LocatorException {
74
        return (PictureMarkerSymbolTableManager) getInstance().get(MANAGER_NAME);
75
    }
76

  
77
    /**
78
     * @return
79
     */
80
    public static Locator getInstance() {
81
        return instance;
82
    }
83

  
84
}
org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38/org.gvsig.legend.picturemarkersymboltable.lib/org.gvsig.legend.picturemarkersymboltable.lib.api/src/main/java/org/gvsig/legend/picturemarkersymboltable/lib/api/PictureMarkerSymbolTableLibrary.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.legend.picturemarkersymboltable.lib.api;
24

  
25
import org.gvsig.fmap.mapcontext.rendering.legend.driver.ILegendWriter;
26
import org.gvsig.symbology.SymbologyLocator;
27
import org.gvsig.symbology.SymbologyManager;
28
import org.gvsig.tools.library.AbstractLibrary;
29
import org.gvsig.tools.library.LibraryException;
30
import org.gvsig.tools.locator.ReferenceNotRegisteredException;
31

  
32

  
33
public class PictureMarkerSymbolTableLibrary extends AbstractLibrary {
34

  
35
    @Override
36
    protected void doInitialize() throws LibraryException {
37
        registerAsAPI(PictureMarkerSymbolTableLibrary.class);
38
    }
39

  
40
    @Override
41
    protected void doPostInitialize() throws LibraryException {
42
        // Validate there is any implementation registered.
43
        PictureMarkerSymbolTableManager manager = PictureMarkerSymbolTableLocator.getPictureMarkerSymbolTableManager();
44
        if (manager == null) {
45
            throw new ReferenceNotRegisteredException(
46
                PictureMarkerSymbolTableLocator.MANAGER_NAME, PictureMarkerSymbolTableLocator.getInstance());
47
        }
48

  
49
        SymbologyManager symbolManager = SymbologyLocator.getSymbologyManager();
50
        ILegendWriter legendWriter = symbolManager.getDefaultLegendWriter();
51
    }
52

  
53
}
org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38/org.gvsig.legend.picturemarkersymboltable.lib/org.gvsig.legend.picturemarkersymboltable.lib.api/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2
  <modelVersion>4.0.0</modelVersion>
3
  <groupId>org.gvsig</groupId>
4
  <artifactId>org.gvsig.legend.picturemarkersymboltable.lib.api</artifactId>
5
  <name>org.gvsig.legend.picturemarkersymboltable.lib.api</name>
6
  <parent>
7
    <groupId>org.gvsig</groupId>
8
    <artifactId>org.gvsig.legend.picturemarkersymboltable.lib</artifactId>
9
    <version>1.0.38</version>
10
  </parent>
11

  
12
  <build>
13
    <plugins>
14
      <plugin>
15
        <groupId>org.apache.maven.plugins</groupId>
16
        <artifactId>maven-jar-plugin</artifactId>
17
        <configuration>
18
        </configuration>
19
        <executions>
20
          <!-- Generates a jar file only with the test classes -->
21
          <execution>
22
            <goals>
23
              <goal>test-jar</goal>
24
            </goals>
25
          </execution>
26
        </executions>
27
      </plugin>
28
    </plugins>
29
  </build>
30

  
31
  <dependencies>
32
    <dependency>
33
      <groupId>org.gvsig</groupId>
34
      <artifactId>org.gvsig.tools.lib</artifactId>
35
      <scope>compile</scope>
36
    </dependency>
37
    <dependency>
38
      <groupId>org.gvsig</groupId>
39
      <artifactId>org.gvsig.fmap.mapcontext.api</artifactId>
40
      <scope>compile</scope>
41
    </dependency>
42
    <dependency>
43
      <groupId>org.gvsig</groupId>
44
      <artifactId>org.gvsig.symbology.lib.api</artifactId>
45
    </dependency>
46
  </dependencies>
47
</project>
0 48

  
org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38/org.gvsig.legend.picturemarkersymboltable.lib/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2
  <modelVersion>4.0.0</modelVersion>
3
  <parent>
4
    <groupId>org.gvsig</groupId>
5
    <artifactId>org.gvsig.legend.picturemarkersymboltable</artifactId>
6
    <version>1.0.38</version>
7
  </parent>
8
  <groupId>org.gvsig</groupId>
9
  <artifactId>org.gvsig.legend.picturemarkersymboltable.lib</artifactId>
10
  <packaging>pom</packaging>
11
  <modules>
12
    <module>org.gvsig.legend.picturemarkersymboltable.lib.api</module>
13
    <module>org.gvsig.legend.picturemarkersymboltable.lib.impl</module>
14
  </modules>
15
</project>
org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38/org.gvsig.legend.picturemarkersymboltable.lib/org.gvsig.legend.picturemarkersymboltable.lib.impl/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2
    <modelVersion>4.0.0</modelVersion>
3
    <artifactId>org.gvsig.legend.picturemarkersymboltable.lib.impl</artifactId>
4
    <name>org.gvsig.legend.picturemarkersymboltable.lib.impl</name>
5
    <parent>
6
        <groupId>org.gvsig</groupId>
7
        <artifactId>org.gvsig.legend.picturemarkersymboltable.lib</artifactId>
8
        <version>1.0.38</version>
9
    </parent>
10
    <groupId>org.gvsig</groupId>
11
    <dependencies>
12
        <dependency>
13
            <groupId>org.gvsig</groupId>
14
            <artifactId>org.gvsig.legend.picturemarkersymboltable.lib.api</artifactId>
15
            <scope>compile</scope>
16
        </dependency>
17
        <dependency>
18
            <groupId>org.gvsig</groupId>
19
            <artifactId>org.gvsig.fmap.dal.api</artifactId>
20
            <scope>compile</scope>
21
        </dependency>
22
        <dependency>
23
            <groupId>org.gvsig</groupId>
24
            <artifactId>org.gvsig.symbology.lib.impl</artifactId>
25
            <scope>compile</scope>
26
        </dependency>
27
        <dependency>
28
            <groupId>org.gvsig</groupId>
29
            <artifactId>org.gvsig.ui</artifactId>
30
            <scope>compile</scope>
31
        </dependency>
32
    
33
        <dependency>
34
            <groupId>org.gvsig</groupId>
35
            <artifactId>org.gvsig.fmap.dal.impl</artifactId>
36
            <scope>test</scope>
37
        </dependency>
38
        <dependency>
39
            <groupId>org.gvsig</groupId>
40
<!--
41
            <artifactId>${org.gvsig.h2spatial.provider}</artifactId>
42
-->
43
            <artifactId>org.gvsig.h2spatial.h2gis132.provider</artifactId>
44
            
45
            <scope>test</scope>
46
        </dependency>
47
        <dependency>
48
            <groupId>org.gvsig</groupId>
49
            <artifactId>${org.gvsig.fmap.geometry.impl}</artifactId>
50
            <scope>test</scope>
51
        </dependency>    
52
        <dependency>
53
            <groupId>org.gvsig</groupId>
54
            <artifactId>org.gvsig.expressionevaluator.lib.impl</artifactId>
55
            <scope>test</scope>
56
        </dependency>    
57
        <dependency>
58
            <groupId>org.gvsig</groupId>
59
            <artifactId>org.gvsig.expressionevaluator.geometry.lib.impl</artifactId>
60
            <scope>test</scope>
61
        </dependency>    
62
        <dependency>
63
            <groupId>org.gvsig</groupId>
64
            <artifactId>${org.gvsig.proj.lib.impl}</artifactId>
65
            <scope>test</scope>
66
        </dependency>
67
        <dependency>
68
            <groupId>org.gvsig</groupId>
69
            <artifactId>org.gvsig.compat.se</artifactId>
70
            <scope>test</scope>
71
        </dependency>
72
        <dependency>
73
            <groupId>org.gvsig</groupId>
74
            <artifactId>org.gvsig.metadata.lib.basic.impl</artifactId>
75
            <scope>test</scope>
76
        </dependency>      
77
        <dependency>
78
            <groupId>org.gvsig</groupId>
79
            <artifactId>org.gvsig.timesupport.lib.impl</artifactId>
80
            <scope>test</scope>
81
        </dependency>
82
        <dependency>
83
            <groupId>org.gvsig</groupId>
84
            <artifactId>org.gvsig.fmap.dal.file.csv</artifactId>
85
            <scope>test</scope>
86
        </dependency>
87
        <dependency>
88
            <groupId>org.gvsig</groupId>
89
            <artifactId>org.gvsig.tools.util.impl</artifactId>
90
            <scope>test</scope>
91
        </dependency>
92
        <dependency>
93
            <groupId>org.gvsig</groupId>
94
            <artifactId>org.gvsig.tools.swing.impl</artifactId>
95
            <scope>test</scope>
96
        </dependency>
97
        <dependency>
98
            <groupId>org.gvsig</groupId>
99
            <artifactId>org.gvsig.fmap.dal.db.jdbc</artifactId>
100
            <scope>compile</scope>
101
        </dependency>
102
    </dependencies>
103
</project>
org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38/org.gvsig.legend.picturemarkersymboltable.lib/org.gvsig.legend.picturemarkersymboltable.lib.impl/src/main/java/org/gvsig/legend/picturemarkersymboltable/lib/impl/PictureMarkerSymbolTableLibraryImpl.java
1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2015 gvSIG Association
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., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24

  
25
package org.gvsig.legend.picturemarkersymboltable.lib.impl;
26

  
27
import java.io.InputStream;
28
import java.util.Map;
29
import org.gvsig.fmap.mapcontext.MapContextLibrary;
30
import org.gvsig.fmap.mapcontext.MapContextLocator;
31
import org.gvsig.fmap.mapcontext.MapContextManager;
32
import org.gvsig.legend.picturemarkersymboltable.lib.api.PictureMarkerSymbolTableLibrary;
33
import org.gvsig.legend.picturemarkersymboltable.lib.api.PictureMarkerSymbolTableLocator;
34
import org.gvsig.symbology.impl.SymbologyDefaultImplLibrary;
35
import org.gvsig.tools.ToolsLocator;
36
import org.gvsig.tools.dynobject.DynStruct;
37
import org.gvsig.tools.library.AbstractLibrary;
38
import org.gvsig.tools.library.LibraryException;
39
import org.gvsig.tools.persistence.PersistenceManager;
40

  
41
public class PictureMarkerSymbolTableLibraryImpl extends AbstractLibrary {
42

  
43
    @Override
44
    public void doRegistration() {
45
        registerAsImplementationOf(PictureMarkerSymbolTableLibrary.class);
46
        this.require(MapContextLibrary.class);
47
        this.require(SymbologyDefaultImplLibrary.class);
48
    }
49

  
50
    @Override
51
    protected void doInitialize() throws LibraryException {
52
        PictureMarkerSymbolTableLocator.registerPictureMarkerSymbolTableManager(DefaultPictureMarkerSymbolTableManager.class);
53
        MapContextManager mapContextManager = MapContextLocator.getMapContextManager();
54
        mapContextManager.registerLegend("PictureMarkerSymbolTableLegend", DefaultPictureMarkerSymbolTableLegend.class);
55
    }
56

  
57
    @Override
58
    protected void doPostInitialize() throws LibraryException {
59
        PersistenceManager persistenceManager = ToolsLocator.getPersistenceManager();
60
        InputStream is = this.getClass().getResourceAsStream("PictureMarkerSymbolTablePersistence.xml");
61
        Map<String,DynStruct> definitions;
62
        try {
63
            definitions = ToolsLocator.getDynObjectManager().importDynClassDefinitions(is, this.getClass().getClassLoader());
64
        } catch (Exception ex) {
65
            throw new LibraryException(this.getClass(), ex);
66
        }
67
        
68
        persistenceManager.addDefinition(
69
                DefaultPictureMarkerSymbolTableLegend.class,
70
                "DefaultPictureMarkerSymbolTableLegend",
71
                definitions,
72
                null,
73
                null
74
        );
75
    }
76

  
77
}
org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38/org.gvsig.legend.picturemarkersymboltable.lib/org.gvsig.legend.picturemarkersymboltable.lib.impl/src/main/java/org/gvsig/legend/picturemarkersymboltable/lib/impl/ImageMarkerSymbol.java
1
package org.gvsig.legend.picturemarkersymboltable.lib.impl;
2

  
3
import java.awt.Graphics2D;
4
import java.awt.Rectangle;
5
import java.awt.geom.AffineTransform;
6
import java.awt.geom.Point2D;
7
import java.awt.image.BufferedImage;
8
import org.gvsig.fmap.dal.feature.Feature;
9
import org.gvsig.fmap.geom.Geometry;
10
import org.gvsig.fmap.geom.aggregate.Aggregate;
11
import org.gvsig.fmap.geom.primitive.Point;
12
import org.gvsig.fmap.mapcontext.MapContext;
13
import org.gvsig.fmap.mapcontext.ViewPort;
14
import org.gvsig.fmap.mapcontext.rendering.symbols.IMultiLayerSymbol;
15
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
16
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.ILineSymbol;
17
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.impl.AbstractLineSymbol;
18
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.IMarkerSymbol;
19
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.impl.AbstractMarkerSymbol;
20
import org.gvsig.tools.swing.api.TransparencySupport;
21
import org.gvsig.tools.task.Cancellable;
22
import org.slf4j.Logger;
23
import org.slf4j.LoggerFactory;
24

  
25
/**
26
 *
27
 * @author gvSIG Team
28
 */
29
@SuppressWarnings("UseSpecificCatch")
30
public class ImageMarkerSymbol extends AbstractMarkerSymbol implements  IMarkerSymbol, IMultiLayerSymbol, TransparencySupport {
31

  
32
    private static final Logger LOGGER = LoggerFactory.getLogger(ImageMarkerSymbol.class);
33
    
34
    private ImageMarkerSymbol selectionSym;
35
    private boolean selected;
36
    private BufferedImage image;
37
    private BufferedImage imagesel;
38
    private ISymbol[] layers;
39
    
40
    private static class ImageSymbol extends AbstractMarkerSymbol implements IMarkerSymbol {
41

  
42
        private final ImageMarkerSymbol parent;
43

  
44
        public ImageSymbol(ImageMarkerSymbol parent) {
45
            this.parent = parent;
46
        }
47
        
48
        @Override
49
        public ISymbol getSymbolForSelection() {
50
            return ((ImageMarkerSymbol)(this.parent.getSymbolForSelection())).getLayer(1);
51
        }
52

  
53
        @Override
54
        public void draw(Graphics2D g, AffineTransform affineTransform, Geometry geom, Feature f, Cancellable cnclbl) {
55
            Point p;
56
            try {
57
                p = geom.centroid();
58
            } catch (Exception ex) {
59
                return;
60
            }
61
            if (affineTransform != null) {
62
                p.transform(affineTransform);
63
            }
64
            double x, y;
65
            int size = (int) Math.round(this.parent.getEfectiveSize(f));
66
            double halfSize = this.parent.getEfectiveSize(f) / 2;
67
            x = p.getX() - halfSize;
68
            y = p.getY() - halfSize;
69
            Point2D theOffset = this.parent.getEfectiveOffset(f);
70
            int xOffset = (int) theOffset.getX();
71
            int yOffset = (int) theOffset.getY();
72

  
73
            if (size > 0) {
74
                Rectangle rect = new Rectangle(size, size);
75
                g.translate(x + xOffset, y + yOffset);
76
                double auxRotation = this.parent.getEfectiveRotationInRadians(f);
77
                g.rotate(auxRotation, halfSize, halfSize);
78

  
79
                this.parent.drawInsideRectangle(g, rect, true);
80

  
81
                g.rotate(-auxRotation, halfSize, halfSize);
82
                g.translate(-(x + xOffset), -(y + yOffset));
83

  
84
            }
85
        }
86

  
87
        @Override
88
        public double toCartographicSize(ViewPort viewPort, double dpi, Geometry geom) {
89
            return this.parent.toCartographicSize(viewPort, dpi, geom); //To change body of generated methods, choose Tools | Templates.
90
        }
91

  
92
        @Override
93
        public void setCartographicSize(double cartographicSize, Geometry geom) {
94
            this.parent.setCartographicSize(cartographicSize, geom); //To change body of generated methods, choose Tools | Templates.
95
        }
96

  
97
        @Override
98
        public int getUnit() {
99
            return this.parent.getUnit();
100
        }
101

  
102
    }
103

  
104
    private static class LineSymbol extends AbstractLineSymbol implements ILineSymbol {
105
        
106
        private final ImageMarkerSymbol parent;
107

  
108
        public LineSymbol(ImageMarkerSymbol parent) {
109
            this.parent = parent;
110
        }
111

  
112
        @Override
113
        public ISymbol getSymbolForSelection() {
114
            return ((ImageMarkerSymbol)(this.parent.getSymbolForSelection())).getLayer(0);
115
        }
116

  
117
        @Override
118
        public void draw(Graphics2D g, AffineTransform affineTransform, Geometry geom, Feature f, Cancellable cnclbl) {
119
            Point p;
120
            try {
121
                p = geom.centroid();
122
            } catch (Exception ex) {
123
                return;
124
            }
125
            if (affineTransform != null) {
126
                p.transform(affineTransform);
127
            }
128
            int size = (int) Math.round(this.parent.getEfectiveSize(f));
129
            Point2D theOffset = this.parent.getEfectiveOffset(f);
130
            int xOffset = (int) theOffset.getX();
131
            int yOffset = (int) theOffset.getY();
132

  
133
            if (size > 0) {
134
                if (this.parent.isDrawLineToOffset()) {
135
                    g.setColor(this.parent.getEfectiveLineToOffsetColor(f));
136
                    g.drawLine((int) p.getX(), (int) p.getY(), (int) p.getX() + xOffset, (int) p.getY() + yOffset);
137
                }
138
            }
139
        }
140

  
141
        @Override
142
        public void setLineWidth(double d) {
143
        }
144

  
145
        @Override
146
        public double getLineWidth() {
147
            return 1;
148
        }
149

  
150
        @Override
151
        public double toCartographicSize(ViewPort viewPort, double dpi, Geometry geom) {
152
            return this.parent.toCartographicSize(viewPort, dpi, geom); //To change body of generated methods, choose Tools | Templates.
153
        }
154

  
155
        @Override
156
        public void setCartographicSize(double cartographicSize, Geometry geom) {
157
            this.parent.setCartographicSize(cartographicSize, geom); //To change body of generated methods, choose Tools | Templates.
158
        }
159

  
160
        @Override
161
        public int getUnit() {
162
            return this.parent.getUnit();
163
        }
164
        
165
    }
166

  
167
    public ImageMarkerSymbol() {
168
        this.layers = new ISymbol[] {new LineSymbol(this), new ImageSymbol(this)};
169
    }
170
    
171
    void setImage(BufferedImage img) {
172
        this.image = img;
173
    }
174
    
175
    void setImageSel(BufferedImage img) {
176
        this.imagesel = img;
177
    }
178
    
179
    @Override
180
    public void draw(Graphics2D g, AffineTransform affineTransform, Geometry geom, Feature f, Cancellable cancel) {
181
        Point p;
182
        try {
183
            p = geom.centroid();
184
        } catch (Exception ex) {
185
            return;
186
        }
187
        try {
188
            if( geom.getType()==Geometry.TYPES.LINE ) {
189
                // Si es una linea, intenta coger un punto aproximadamene 
190
                // sobre el centro de la linea.
191
                p = (Point) geom.closestPoints(p)[0];
192
            } else if( geom.getType()==Geometry.TYPES.MULTILINE && ((Aggregate)geom).getPrimitivesNumber()==1 ) {
193
                // Si es una multilinea compuesta por solo una linea, intenta
194
                // coger un punto aproximadamene sobre el centro de esa linea
195
                p = (Point) ((Aggregate)geom).getPrimitiveAt(0).closestPoints(p)[0];
196
            }
197
        } catch(Throwable th) {
198
            // Do nothing, ignore error and use centroid
199
            LOGGER.debug("Problems calculating the center of geometry",th);
200
        }
201
        
202
        if (affineTransform != null) {
203
            p.transform(affineTransform);
204
        }
205
        double x, y;
206
        int size = (int) Math.round(getEfectiveSize(f));
207
        double halfSize = getEfectiveSize(f) / 2;
208
        x = p.getX() - halfSize;
209
        y = p.getY() - halfSize;
210
        Point2D theOffset = this.getEfectiveOffset(f);
211
        int xOffset = (int) theOffset.getX();
212
        int yOffset = (int) theOffset.getY();
213

  
214
        if (size > 0) {
215
            if( isDrawLineToOffset() ) {
216
                g.setColor(this.getEfectiveLineToOffsetColor(f));
217
                g.drawLine((int)p.getX(), (int)p.getY(), (int)p.getX() + xOffset, (int)p.getY() + yOffset);
218
            }
219
            Rectangle rect = new Rectangle(size, size);
220
            g.translate(x + xOffset, y + yOffset);
221
            double auxRotation = getEfectiveRotationInRadians(f);
222
            g.rotate(auxRotation, halfSize, halfSize);
223
            
224
            this.drawInsideRectangle(g, rect, true);
225
            
226
            g.rotate(-auxRotation, halfSize, halfSize);
227
            g.translate(-(x + xOffset), -(y + yOffset));
228
            
229
        }
230
    }
231

  
232
    private void drawInsideRectangle(Graphics2D g, Rectangle r, boolean keepAspectRatio) {
233
        BufferedImage theImage = (!selected) ? this.image : this.imagesel;
234
        if (theImage != null) {
235

  
236
            double xOffset = 0;
237
            double yOffset = 0;
238
            @SuppressWarnings("UnusedAssignment")
239
            double xScale = 1;
240
            @SuppressWarnings("UnusedAssignment")
241
            double yScale = 1;
242
            if (keepAspectRatio) {
243
                double scale;
244
                if (theImage.getWidth() > theImage.getHeight()) {
245
                    scale = r.getWidth() / theImage.getWidth();
246
                    yOffset = 0.5 * (r.getHeight() - theImage.getHeight() * scale);
247
                } else {
248
                    scale = r.getHeight() / theImage.getHeight();
249
                    xOffset = 0.5 * (r.getWidth() - theImage.getWidth() * scale);
250
                }
251
                xScale = yScale = scale;
252

  
253
            } else {
254
                xScale = r.getWidth() / theImage.getWidth();
255
                yScale = r.getHeight() / theImage.getHeight();
256
                yOffset = theImage.getHeight() * 0.5 * yScale;
257

  
258
            }
259

  
260
            AffineTransform at = AffineTransform.getTranslateInstance(xOffset, yOffset);
261
            at.concatenate(AffineTransform.getScaleInstance(xScale, yScale));
262
            g.drawRenderedImage(theImage, at);
263
        }
264
        
265
    }
266
    
267
    
268
    @Override
269
    public ISymbol getSymbolForSelection() {
270
        if (selectionSym == null) {
271
            try {
272
                selectionSym = (ImageMarkerSymbol) this.clone();
273
            } catch (CloneNotSupportedException e) {
274
//                LOG.warn("Error creating the selection symbol for the symbol "+ this, e);
275
            }
276
            selectionSym.selected = true;
277
            selectionSym.selectionSym = selectionSym; // avoid too much lazy creations
278
        } else {
279
            selectionSym.setColor(MapContext.getSelectionColor());
280
        }
281
        return selectionSym;
282
    }
283

  
284
    @Override
285
    public Object clone() throws CloneNotSupportedException {
286
        ImageMarkerSymbol copy = (ImageMarkerSymbol) super.clone();
287
        copy.layers = new ISymbol[] {new LineSymbol(copy), new ImageSymbol(copy)};
288

  
289
        return copy;
290
    }
291

  
292
    @Override
293
    public void setTransparency(double d) {
294
    }
295

  
296
    @Override
297
    public double getTransparency() {
298
        return 0;
299
    }
300

  
301
    @Override
302
    public void setLayer(int i, ISymbol is) throws IndexOutOfBoundsException {
303
    }
304

  
305
    @Override
306
    public void swapLayers(int i, int i1) {
307
    }
308

  
309
    @Override
310
    public ISymbol getLayer(int i) {
311
        return getLayers()[i];
312
    }
313

  
314
    @Override
315
    public int getLayerCount() {
316
        return 2;
317
    }
318

  
319
    @Override
320
    public void addLayer(ISymbol is) {
321
    }
322

  
323
    @Override
324
    public void addLayer(ISymbol is, int i) throws IndexOutOfBoundsException {
325
    }
326

  
327
    @Override
328
    public boolean removeLayer(ISymbol is) {
329
        return false;
330
    }
331

  
332
    public ISymbol[] getLayers() {
333
        return layers;
334
    }
335
    
336
    
337
    
338
}
org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38/org.gvsig.legend.picturemarkersymboltable.lib/org.gvsig.legend.picturemarkersymboltable.lib.impl/src/main/java/org/gvsig/legend/picturemarkersymboltable/lib/impl/DefaultPictureMarkerSymbolTableManager.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.legend.picturemarkersymboltable.lib.impl;
24

  
25
import org.gvsig.legend.picturemarkersymboltable.lib.api.PictureMarkerSymbolTableLegend;
26
import org.gvsig.legend.picturemarkersymboltable.lib.api.PictureMarkerSymbolTableManager;
27
import org.slf4j.Logger;
28
import org.slf4j.LoggerFactory;
29

  
30
@SuppressWarnings("UseSpecificCatch")
31
public class DefaultPictureMarkerSymbolTableManager implements PictureMarkerSymbolTableManager {
32

  
33
    private static final Logger LOGGER = LoggerFactory.getLogger(DefaultPictureMarkerSymbolTableManager.class);
34

  
35
    @Override
36
    public PictureMarkerSymbolTableLegend createPictureMarkerSymbolTableLegend() {
37
        return new DefaultPictureMarkerSymbolTableLegend();
38
    }
39

  
40
    @Override
41
    public Class<? extends PictureMarkerSymbolTableLegend> getPictureMarkerSymbolTableLegendClass() {
42
        return DefaultPictureMarkerSymbolTableLegend.class;
43
    }
44

  
45
    
46
}
org.gvsig.legend.picturemarkersymboltable/tags/org.gvsig.legend.picturemarkersymboltable-1.0.38/org.gvsig.legend.picturemarkersymboltable.lib/org.gvsig.legend.picturemarkersymboltable.lib.impl/src/main/java/org/gvsig/legend/picturemarkersymboltable/lib/impl/DefaultPictureMarkerSymbolTableLegend.java
1
package org.gvsig.legend.picturemarkersymboltable.lib.impl;
2

  
3
import java.awt.Color;
4
import java.awt.geom.Point2D;
5
import java.awt.image.BufferedImage;
6
import java.net.URL;
7
import java.util.ArrayList;
8
import java.util.List;
9
import javax.annotation.processing.SupportedSourceVersion;
10
import javax.lang.model.SourceVersion;
11
import org.apache.commons.collections4.map.LRUMap;
12
import org.apache.commons.lang3.StringUtils;
13
import org.gvsig.expressionevaluator.ExpressionBuilder;
14
import org.gvsig.expressionevaluator.ExpressionUtils;
15
import org.gvsig.fmap.dal.DALLocator;
16
import org.gvsig.fmap.dal.DataTypes;
17
import org.gvsig.fmap.dal.StoresRepository;
18
import org.gvsig.fmap.dal.exception.DataException;
19
import org.gvsig.fmap.dal.feature.Feature;
20
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor;
21
import org.gvsig.fmap.dal.feature.FeatureStore;
22
import org.gvsig.fmap.dal.feature.FeatureType;
23
import org.gvsig.fmap.geom.Geometry;
24
import org.gvsig.fmap.geom.GeometryUtils;
25
import org.gvsig.fmap.mapcontext.MapContextException;
26
import org.gvsig.fmap.mapcontext.rendering.legend.ZSort;
27
import org.gvsig.fmap.mapcontext.rendering.legend.events.IntervalLegendEvent;
28
import org.gvsig.fmap.mapcontext.rendering.legend.events.LabelLegendEvent;
29
import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendChangedEvent;
30
import org.gvsig.fmap.mapcontext.rendering.legend.events.LegendClearEvent;
31
import org.gvsig.fmap.mapcontext.rendering.legend.events.SymbolLegendEvent;
32
import org.gvsig.fmap.mapcontext.rendering.legend.events.ValueLegendEvent;
33
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
34
import org.gvsig.legend.picturemarkersymboltable.lib.api.PictureMarkerSymbolTableLegend;
35
import org.gvsig.symbology.SymbologyLocator;
36
import org.gvsig.symbology.SymbologyManager;
37
import org.gvsig.symbology.fmap.mapcontext.rendering.legend.impl.AbstractVectorialLegend;
38
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.ISimpleMarkerSymbol;
39
import org.gvsig.tools.ToolsLocator;
40
import org.gvsig.tools.dataTypes.Coercion;
41
import org.gvsig.tools.persistence.PersistentState;
42
import org.gvsig.tools.persistence.exception.PersistenceException;
43
import org.gvsig.tools.swing.api.SimpleImage;
44
import org.gvsig.tools.swing.api.ToolsSwingLocator;
45
import org.slf4j.Logger;
46
import org.slf4j.LoggerFactory;
47

  
48
@SupportedSourceVersion(SourceVersion.RELEASE_8)
49
@SuppressWarnings("UseSpecificCatch")
50
public class DefaultPictureMarkerSymbolTableLegend 
51
        extends AbstractVectorialLegend 
52
        implements PictureMarkerSymbolTableLegend 
53
{
54
    
55
    private static final Logger LOGGER = LoggerFactory.getLogger(DefaultPictureMarkerSymbolTableLegend.class);
56

  
57
    private static final int IMAGESCACHE_SIZE = 100;
58
    
59
    /** 
60
     * defaultSimbol no se usa para nada. 
61
     * Lo inicializamos en el constructor a SimpleMarkerSymbol por si a caso 
62
     * alguien lo consulta, por ejemplo al persistir el ImageMarkerSimbol.
63
     */
64
    transient private final ISimpleMarkerSymbol defaultSymbol;
65
    
66
    transient private final Coercion toColor;
67
    transient private FeatureStore imagesStore;
68
    transient private ExpressionBuilder expressionBuilder;
69
    transient private final LRUMap<Object, BufferedImage[]> imagesCache;
70
    
71
    private double size;
72
    private int units;
73
    private Color lineToOffsetColor;
74
    private boolean drawLineToOffset;
75

  
76
    private String classifyingFieldName;
77
    private String offsetXFieldName;
78
    private String offsetYFieldName;
79
    private String rotationFieldName;
80
    private String lineToOffsetColorFieldlName;
81

  
82
    private String imagesTableName;
83
    private String imagesTableClassifyingFieldName;
84
    private String imageFieldName;
85
    private String imageSelectedFieldName;
86
    private SimpleImage imageNotFound;
87
    
88
    private double scale;
89
    private boolean reverseDirectionOfAngle;
90

  
91
    private class MyZSort extends ZSort {
92
        
93
	public MyZSort() {
94
		super();
95
	}
96

  
97
        @Override
98
	public void legendChanged(LegendChangedEvent e) throws MapContextException {
99
//		symbols.clear();
100
//		usingZSort = false;
101
//		initialize(e.getNewLegend());
102

  
103
	}
104

  
105
        @Override
106
	public String getClassName() {
107
		return getClass().getName();
108
	}
109

  
110
        @Override
111
	public int getLevelCount() {
112
		return 2;
113
	}
114

  
115
        @Override
116
	public void setUsingZSort(boolean usingZSort) {
117
	}
118

  
119
        @Override
120
	public void setLevels(ISymbol sym, int[] values) {
121
	}
122

  
123
        @Override
124
	public void setLevels(int row, int[] values) {
125
	}
126

  
127
        @Override
128
	public int[] getLevels(ISymbol sym) {
129
		return new int[]{0,1};
130
	}
131

  
132
        @Override
133
	public int[] getLevels(int row) {
134
		return null;
135
	}
136

  
137
        @Override
138
	public boolean isUsingZSort() {
139
		return true;
140
	}
141

  
142
        @Override
143
	public ISymbol[] getSymbols() {
144
		return null;
145
	}
146

  
147
        @Override
148
	public String[] getDescriptions() {
149
            return new String[] {"line", "Image"};
150
	}
151

  
152
        @Override
153
	public int getTopLevelIndexAllowed() {
154
		return 0;
155
	}
156

  
157
        @Override
158
	public String toString() {
159
            return "Line, Image";
160
	}
161

  
162
        @Override
163
	public boolean symbolChanged(SymbolLegendEvent e) {
164
		return true;
165
	}
166

  
167
        @Override
168
	public boolean classifiedSymbolChange(SymbolLegendEvent e) {
169
		return true;
170
	}
171

  
172
        @Override
173
	public boolean intervalChange(IntervalLegendEvent e) {
174
		return false;
175
	}
176

  
177
        @Override
178
	public boolean valueChange(ValueLegendEvent e) {
179
		return false;
180
	}
181

  
182
	// TODO should not exist here
183
        @Override
184
	public boolean labelFieldChange(LabelLegendEvent e) {
185
		return false;
186
	}
187

  
188
        @Override
189
	public void legendCleared(LegendClearEvent event) {
190
	}
191
        
192
    }
193
    
194
    public DefaultPictureMarkerSymbolTableLegend() {
195
        
196
        SymbologyManager symbologyManager = SymbologyLocator.getSymbologyManager();
197
        this.scale = 1;
198
        this.defaultSymbol = symbologyManager.createSimpleMarkerSymbol();
199
        this.toColor = ToolsLocator.getDataTypesManager().getCoercion(DataTypes.COLOR);
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff