gvsig-sldtools / org.gvsig.sld / org.gvsig.sldconverter / org.gvsig.sldconverter.lib / org.gvsig.sldconverter.lib.impl / src / main / java / org / gvsig / sldconverter / impl / symbol / BasicSymbolConverterFactory.java @ 46
History | View | Annotate | Download (3.52 KB)
1 |
/*******************************************************************************
|
---|---|
2 |
*
|
3 |
* gvSIG. Desktop Geographic Information System.
|
4 |
*
|
5 |
* Copyright (C) 2007-2013 gvSIG Association.
|
6 |
*
|
7 |
* This program is free software; you can redistribute it and/or
|
8 |
* modify it under the terms of the GNU General Public License
|
9 |
* as published by the Free Software Foundation; either version 3
|
10 |
* of the License, or (at your option) any later version.
|
11 |
*
|
12 |
* This program is distributed in the hope that it will be useful,
|
13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15 |
* GNU General Public License for more details.
|
16 |
*
|
17 |
* You should have received a copy of the GNU General Public License
|
18 |
* along with this program; if not, write to the Free Software
|
19 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
20 |
* MA 02110-1301, USA.
|
21 |
*
|
22 |
* For any additional information, do not hesitate to contact us
|
23 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
24 |
*
|
25 |
*******************************************************************************/
|
26 |
package org.gvsig.sldconverter.impl.symbol; |
27 |
|
28 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
29 |
import org.gvsig.sldconverter.SLDConverterManager; |
30 |
import org.gvsig.sldconverter.symbol.SLDToSymbolConverter; |
31 |
import org.gvsig.sldconverter.symbol.SLDToSymbolConverterFactory; |
32 |
import org.gvsig.sldconverter.symbol.SymbolToSLDConverter; |
33 |
import org.gvsig.sldconverter.symbol.SymbolToSLDConverterFactory; |
34 |
import org.gvsig.sldsupport.sld.symbol.SLDLineSymbol; |
35 |
import org.gvsig.sldsupport.sld.symbol.SLDPointSymbol; |
36 |
import org.gvsig.sldsupport.sld.symbol.SLDPolygonSymbol; |
37 |
import org.gvsig.sldsupport.sld.symbol.SLDSymbol; |
38 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.IFillSymbol; |
39 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.IMultiLayerFillSymbol; |
40 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.ILineSymbol; |
41 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.line.IMultiLayerLineSymbol; |
42 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.IMarkerSymbol; |
43 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.marker.IMultiLayerMarkerSymbol; |
44 |
|
45 |
public class BasicSymbolConverterFactory |
46 |
implements SymbolToSLDConverterFactory, SLDToSymbolConverterFactory {
|
47 |
|
48 |
public int canConvert(SLDSymbol sldSym) { |
49 |
|
50 |
if (sldSym instanceof SLDPointSymbol |
51 |
|| sldSym instanceof SLDLineSymbol
|
52 |
|| sldSym instanceof SLDPolygonSymbol) {
|
53 |
|
54 |
/*
|
55 |
* This allows precedence of specific conversors
|
56 |
*/
|
57 |
return SLDConverterManager.CAN_CONVERT_PARTIALLY;
|
58 |
} else {
|
59 |
/*
|
60 |
* SLDRasterSymbol
|
61 |
* SLDTextSymbol
|
62 |
* SLDMappedColorSymbol
|
63 |
*/
|
64 |
return SLDConverterManager.CAN_NOT_CONVERT;
|
65 |
} |
66 |
|
67 |
} |
68 |
|
69 |
public SLDToSymbolConverter createSLDToSymbolConverter() {
|
70 |
return new BasicSymbolConverter(); |
71 |
} |
72 |
|
73 |
// ======================================
|
74 |
|
75 |
public int canConvert(ISymbol sym) { |
76 |
|
77 |
if (sym instanceof IMultiLayerMarkerSymbol |
78 |
|| sym instanceof IMultiLayerLineSymbol
|
79 |
|| sym instanceof IMultiLayerFillSymbol
|
80 |
|| sym instanceof IMarkerSymbol
|
81 |
|| sym instanceof ILineSymbol
|
82 |
|| sym instanceof IFillSymbol) {
|
83 |
|
84 |
|
85 |
return SLDConverterManager.CAN_CONVERT_PARTIALLY;
|
86 |
} else {
|
87 |
return SLDConverterManager.CAN_NOT_CONVERT;
|
88 |
} |
89 |
} |
90 |
|
91 |
public SymbolToSLDConverter createSymbolToSLDConverter() {
|
92 |
return new BasicSymbolConverter(); |
93 |
} |
94 |
|
95 |
} |