Revision 772 2.1/trunk/org.gvsig.view3d/org.gvsig.view3d.vector/org.gvsig.view3d.vector.lib/org.gvsig.view3d.vector.lib.impl/src/main/java/org/gvsig/view3d/vector/lib/impl/extrusion/DefaultVectorExtrusionPolygonRenderableLayer.java
DefaultVectorExtrusionPolygonRenderableLayer.java | ||
---|---|---|
17 | 17 |
import org.gvsig.fmap.geom.primitive.Point; |
18 | 18 |
import org.gvsig.fmap.geom.primitive.Polygon; |
19 | 19 |
import org.gvsig.fmap.geom.primitive.Ring; |
20 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
21 | 20 |
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend; |
22 | 21 |
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol; |
23 | 22 |
import org.gvsig.symbology.fmap.mapcontext.rendering.symbol.fill.IFillSymbol; |
... | ... | |
40 | 39 |
|
41 | 40 |
public DefaultVectorExtrusionPolygonRenderableLayer(VectorLoaderParameters parameters, FeatureStore featureStore, |
42 | 41 |
IVectorLegend legend) { |
43 |
super(parameters, featureStore); |
|
44 |
this.normalShapeAttributes = getNormalShapeAttributes(legend); |
|
45 |
this.sideShapeAttributes = getSideShapeAttributes(legend); |
|
42 |
super(parameters, featureStore, legend); |
|
46 | 43 |
} |
47 | 44 |
|
48 | 45 |
@Override |
... | ... | |
111 | 108 |
renderable.addInnerBoundary(getInteriorRing(polygon.getInteriorRing(i), hasZ, h)); |
112 | 109 |
} |
113 | 110 |
renderable.setAltitudeMode(getAltitudeMode(this.parameters.getVectorElevationMode())); |
114 |
renderable.setAttributes(normalShapeAttributes);
|
|
115 |
renderable.setSideAttributes(sideShapeAttributes);
|
|
111 |
renderable.setAttributes(getNormalShapeAttributes(legend));
|
|
112 |
renderable.setSideAttributes(getSideShapeAttributes(legend));
|
|
116 | 113 |
return renderable; |
117 | 114 |
} |
118 | 115 |
|
... | ... | |
132 | 129 |
} |
133 | 130 |
|
134 | 131 |
private BasicShapeAttributes getSideShapeAttributes(IVectorLegend legend) { |
132 |
|
|
133 |
if(this.sideShapeAttributes != null) { |
|
134 |
return this.sideShapeAttributes; |
|
135 |
} |
|
136 |
|
|
135 | 137 |
Material sideFillMaterial = Material.GRAY; |
136 | 138 |
double fillOpacity = 0.7; |
137 | 139 |
|
... | ... | |
147 | 149 |
sideFillMaterial = new Material(this.parameters.getDefaultColor()); |
148 | 150 |
fillOpacity = 0.7; |
149 | 151 |
} |
150 |
BasicShapeAttributes attr = new BasicShapeAttributes();
|
|
151 |
attr.setInteriorMaterial(sideFillMaterial);
|
|
152 |
attr.setInteriorOpacity(fillOpacity);
|
|
153 |
return attr;
|
|
152 |
sideShapeAttributes = new BasicShapeAttributes();
|
|
153 |
sideShapeAttributes.setInteriorMaterial(sideFillMaterial);
|
|
154 |
sideShapeAttributes.setInteriorOpacity(fillOpacity);
|
|
155 |
return sideShapeAttributes;
|
|
154 | 156 |
} |
155 | 157 |
|
156 | 158 |
private BasicShapeAttributes getNormalShapeAttributes(IVectorLegend legend) { |
159 |
|
|
160 |
if(this.normalShapeAttributes != null) { |
|
161 |
return this.normalShapeAttributes; |
|
162 |
} |
|
163 |
|
|
157 | 164 |
Material fillMaterial = Material.LIGHT_GRAY; |
158 | 165 |
Material outlineMaterial = Material.BLACK; |
159 | 166 |
double fillOpacity = 0.7; |
... | ... | |
176 | 183 |
fillOpacity = 0.7; |
177 | 184 |
outlineWidth = 2; |
178 | 185 |
} |
179 |
BasicShapeAttributes attr = new BasicShapeAttributes();
|
|
180 |
attr.setInteriorMaterial(fillMaterial);
|
|
181 |
attr.setInteriorOpacity(fillOpacity);
|
|
182 |
attr.setOutlineMaterial(outlineMaterial);
|
|
183 |
attr.setOutlineWidth(outlineWidth);
|
|
184 |
return attr;
|
|
186 |
normalShapeAttributes = new BasicShapeAttributes();
|
|
187 |
normalShapeAttributes.setInteriorMaterial(fillMaterial);
|
|
188 |
normalShapeAttributes.setInteriorOpacity(fillOpacity);
|
|
189 |
normalShapeAttributes.setOutlineMaterial(outlineMaterial);
|
|
190 |
normalShapeAttributes.setOutlineWidth(outlineWidth);
|
|
191 |
return normalShapeAttributes;
|
|
185 | 192 |
} |
186 | 193 |
|
187 | 194 |
/** |
... | ... | |
196 | 203 |
int r = color.getRed(); |
197 | 204 |
int g = color.getGreen(); |
198 | 205 |
int b = color.getBlue(); |
199 |
Color sideFillColor = new Color(Math.max((int) (r * factor), 0), Math.max((int) (g * factor), 0),
|
|
206 |
return new Color(Math.max((int) (r * factor), 0), Math.max((int) (g * factor), 0),
|
|
200 | 207 |
Math.max((int) (b * factor), 0)); |
201 |
return sideFillColor; |
|
202 | 208 |
} |
209 |
|
|
210 |
@Override |
|
211 |
protected void clearRenderAttributes() { |
|
212 |
this.normalShapeAttributes = null; |
|
213 |
this.sideShapeAttributes = null; |
|
214 |
} |
|
203 | 215 |
} |
Also available in: Unified diff