Revision 25228
trunk/libraries/lib3DMap/src/org/gvsig/gvsig3d/gui/FeatureFactory.java | ||
---|---|---|
12 | 12 |
import org.gvsig.gvsig3d.utils.Punto3D; |
13 | 13 |
import org.gvsig.osgvp.AutoTransform; |
14 | 14 |
import org.gvsig.osgvp.Geode; |
15 |
import org.gvsig.osgvp.Geometry; |
|
16 | 15 |
import org.gvsig.osgvp.Group; |
17 | 16 |
import org.gvsig.osgvp.Node; |
18 | 17 |
import org.gvsig.osgvp.Optimizer; |
... | ... | |
22 | 21 |
import org.gvsig.osgvp.exceptions.InvalidValueException; |
23 | 22 |
import org.gvsig.osgvp.exceptions.node.NodeException; |
24 | 23 |
import org.gvsig.osgvp.features.PixelPoint; |
24 |
import org.gvsig.osgvp.features.PointExtruder; |
|
25 | 25 |
import org.gvsig.osgvp.features.Polygon; |
26 | 26 |
import org.gvsig.osgvp.features.PolygonExtruder; |
27 | 27 |
import org.gvsig.osgvp.features.Polyline; |
28 |
import org.gvsig.osgvp.features.PolylineExtruder; |
|
28 | 29 |
import org.gvsig.osgvp.features.QuadPoint; |
29 | 30 |
import org.gvsig.osgvp.features.TessellablePolygon; |
30 | 31 |
import org.gvsig.osgvp.features.Text; |
31 | 32 |
import org.gvsig.osgvp.planets.Planet; |
32 | 33 |
|
33 |
import com.hardcode.gdbms.driver.exceptions.ReadDriverException; |
|
34 | 34 |
import com.iver.ai2.gvsig3d.resources.ResourcesFactory; |
35 | 35 |
import com.iver.cit.gvsig.fmap.core.v02.FLabel; |
36 | 36 |
import com.iver.cit.gvsig.fmap.rendering.styling.labeling.AttrInTableLabelingStrategy; |
... | ... | |
471 | 471 |
return p; |
472 | 472 |
} |
473 | 473 |
|
474 |
public static Node insertPointExtruded(List points, Vec4 color,String texture,double heigth) { |
|
475 |
// Creating a polygon |
|
476 |
PixelPoint p = null; |
|
477 |
try { |
|
478 |
p = new PixelPoint(); |
|
479 |
} catch (NodeException e1) { |
|
480 |
// TODO Auto-generated catch block |
|
481 |
e1.printStackTrace(); |
|
482 |
} |
|
483 |
// Adding points |
|
484 |
for (int i = 0; i < points.size(); i++) { |
|
485 |
Vec3 element = (Vec3) points.get(i); |
|
486 |
p.addVertex(element, color); |
|
487 |
//p.addPoint3D(element); |
|
488 |
} |
|
489 |
PointExtruder pe = new PointExtruder(); |
|
490 |
pe.extrude(p,new Vec3 (0.0,0.0,1.0), heigth); |
|
491 |
|
|
492 |
|
|
493 |
Group group = new Group(); |
|
494 |
Geode geode = new Geode(); |
|
495 |
|
|
496 |
geode.getOrCreateStateSet().setTwoSidedLighting(true); |
|
497 |
try { |
|
498 |
geode.addDrawable(pe.getGeometry()); |
|
499 |
group.addChild(geode); |
|
500 |
} catch (NodeException e) { |
|
501 |
logger.error("Command:" + "Error adding drawable object.",e); |
|
502 |
} |
|
503 |
|
|
504 |
return group; |
|
505 |
} |
|
506 |
|
|
507 |
|
|
508 |
|
|
474 | 509 |
/** |
475 | 510 |
* Create a new quad point node with a color, size and texture. Using a position of 3D |
476 | 511 |
* points |
... | ... | |
730 | 765 |
} |
731 | 766 |
|
732 | 767 |
// Set up parameters |
733 |
// p.setType(Polygon.PolygonType.FILLED_POLYGON); |
|
734 | 768 |
p.setWidth(2f); |
735 |
// p.setPattern((short) 0xFFFF); |
|
736 |
// p.setFactor(2); |
|
737 | 769 |
p.setType(Polygon.PolygonType.FILLED_POLYGON); |
738 |
// p.setType(Polygon.PolygonType.EMPTY_POLYGON); |
|
739 |
// p.setType(Polygon.PolygonType.PATTERN_POLYGON); |
|
740 |
|
|
741 | 770 |
// Blending only is active if the alpha component are diferent that 1 |
742 |
// if (color.w() != 1) {
|
|
743 |
// p.setEnabledBlending(true);
|
|
744 |
// }
|
|
771 |
if (color.w() != 1) { |
|
772 |
p.setEnabledBlending(true); |
|
773 |
} |
|
745 | 774 |
List positionTapa = new ArrayList(); |
746 | 775 |
// Adding points |
747 | 776 |
for (int i = 0; i < points.size(); i++) { |
748 | 777 |
Vec3 element = (Vec3) points.get(i); |
749 | 778 |
Vec3 elementTapa = new Vec3(element.x(),element.y(),element.z()+heigth); |
750 | 779 |
positionTapa.add(elementTapa); |
751 |
// System.out.println("posicion : " + element.z()); |
|
752 | 780 |
p.addVertex(element, color); |
753 | 781 |
} |
754 | 782 |
|
755 |
|
|
756 |
|
|
757 | 783 |
PolygonExtruder pe = new PolygonExtruder(); |
758 | 784 |
pe.extrude(p,new Vec3 (0.0,0.0,1.0), heigth); |
759 | 785 |
|
... | ... | |
779 | 805 |
geode.addDrawable(pe.getGeometry()); |
780 | 806 |
group.addChild(geode); |
781 | 807 |
group.addChild(node); |
782 |
// if (color.w() != 1) { |
|
783 |
// group.getOrCreateStateSet().setEnabledBlending(true); |
|
784 |
// } |
|
785 | 808 |
} catch (NodeException e) { |
786 | 809 |
logger.error("Command:" + "Error adding drawable object.",e); |
787 | 810 |
} |
788 | 811 |
|
789 |
// Return node |
|
790 |
// return geode; |
|
791 | 812 |
return group; |
792 | 813 |
} |
793 | 814 |
/** |
... | ... | |
857 | 878 |
return p; |
858 | 879 |
|
859 | 880 |
} |
881 |
|
|
882 |
public static Node insertLineExtruded(List points, Vec4 color,String texture,double heigth) { |
|
883 |
// Creating a polygon |
|
884 |
Polyline p = null; |
|
885 |
try { |
|
886 |
p = new Polyline(); |
|
887 |
} catch (NodeException e1) { |
|
888 |
// TODO Auto-generated catch block |
|
889 |
e1.printStackTrace(); |
|
890 |
} |
|
860 | 891 |
|
892 |
// Set up parameters |
|
893 |
p.setWidth(2f); |
|
894 |
|
|
895 |
// Blending only is active if the alpha component are diferent that 1 |
|
896 |
if (color.w() != 1) { |
|
897 |
p.setEnabledBlending(true); |
|
898 |
} |
|
899 |
// List positionTapa = new ArrayList(); |
|
900 |
// Adding points |
|
901 |
for (int i = 0; i < points.size(); i++) { |
|
902 |
Vec3 element = (Vec3) points.get(i); |
|
903 |
p.addVertex(element, color); |
|
904 |
} |
|
905 |
PolylineExtruder pe = new PolylineExtruder(); |
|
906 |
pe.extrude(p,new Vec3 (0.0,0.0,1.0), heigth); |
|
907 |
|
|
908 |
|
|
909 |
Group group = new Group(); |
|
910 |
Geode geode = new Geode(); |
|
911 |
|
|
912 |
geode.getOrCreateStateSet().setTwoSidedLighting(true); |
|
913 |
try { |
|
914 |
geode.addDrawable(pe.getGeometry()); |
|
915 |
group.addChild(geode); |
|
916 |
} catch (NodeException e) { |
|
917 |
logger.error("Command:" + "Error adding drawable object.",e); |
|
918 |
} |
|
919 |
|
|
920 |
return group; |
|
921 |
} |
|
922 |
|
|
923 |
|
|
924 |
|
|
925 |
|
|
926 |
|
|
861 | 927 |
/** |
862 | 928 |
* Create a new group of 3D points with a color and size. Using a List of 3D |
863 | 929 |
* points |
trunk/libraries/lib3DMap/src/org/gvsig/gvsig3d/simbology3D/Line3DFeature.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import org.apache.log4j.Logger; |
4 | 4 |
import org.gvsig.gvsig3d.simbology3D.geometry3D.Line3DGeometry; |
5 |
import org.gvsig.gvsig3d.simbology3D.symbol3D.Abstract3DSymbol; |
|
6 |
import org.gvsig.gvsig3d.simbology3D.symbol3D.polyline.ExtrusionLine3DSymbol; |
|
5 | 7 |
import org.gvsig.gvsig3d.simbology3D.symbol3D.polyline.SimpleLine3DSymbol; |
6 | 8 |
import org.gvsig.osgvp.Group; |
7 | 9 |
import org.gvsig.osgvp.exceptions.node.NodeException; |
8 | 10 |
import org.gvsig.osgvp.planets.Planet; |
9 | 11 |
|
12 |
import com.iver.ai2.gvsig3d.legend.symbols.BaseExtrusionSymbol; |
|
10 | 13 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
11 | 14 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
12 | 15 |
|
13 | 16 |
public class Line3DFeature extends AbstractFeature3D { |
14 | 17 |
|
15 | 18 |
private Line3DGeometry l3DGeometry; |
16 |
private SimpleLine3DSymbol l3DSymbol;
|
|
19 |
private Abstract3DSymbol l3DSymbol;
|
|
17 | 20 |
|
18 | 21 |
private static Logger logger = Logger.getLogger(Line3DFeature.class |
19 | 22 |
.getName()); |
... | ... | |
23 | 26 |
l3DGeometry = new Line3DGeometry(geometry); |
24 | 27 |
// l3DGeometry = (Line3DGeometry) this.getGeometry(); |
25 | 28 |
// l3DSymbol = (SimpleLine3DSymbol) this.getSymbol(); |
26 |
l3DSymbol = new SimpleLine3DSymbol(symbol); |
|
29 |
|
|
30 |
if (this.getSymbol().getClass().equals(BaseExtrusionSymbol.class)) { |
|
31 |
l3DSymbol = new ExtrusionLine3DSymbol(symbol); |
|
32 |
} else { |
|
33 |
l3DSymbol = new SimpleLine3DSymbol(symbol); |
|
34 |
} |
|
35 |
|
|
27 | 36 |
|
28 | 37 |
} |
29 | 38 |
|
trunk/libraries/lib3DMap/src/org/gvsig/gvsig3d/simbology3D/Point3DFeature.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import org.apache.log4j.Logger; |
4 | 4 |
import org.gvsig.gvsig3d.simbology3D.geometry3D.Point3DGeometry; |
5 |
import org.gvsig.gvsig3d.simbology3D.symbol3D.I3DSymbol;
|
|
5 |
import org.gvsig.gvsig3d.simbology3D.symbol3D.Abstract3DSymbol;
|
|
6 | 6 |
import org.gvsig.gvsig3d.simbology3D.symbol3D.point.CharacterPoint3DSymbol; |
7 |
import org.gvsig.gvsig3d.simbology3D.symbol3D.point.ExtrusionPoint3DSymbol; |
|
7 | 8 |
import org.gvsig.gvsig3d.simbology3D.symbol3D.point.MultiLayerPoint3DSymbol; |
8 | 9 |
import org.gvsig.gvsig3d.simbology3D.symbol3D.point.ObjectPoint3DSymbol; |
9 | 10 |
import org.gvsig.gvsig3d.simbology3D.symbol3D.point.PicturePoint3DSymbol; |
... | ... | |
15 | 16 |
import org.gvsig.symbology.fmap.symbols.PictureMarkerSymbol; |
16 | 17 |
|
17 | 18 |
import com.iver.ai2.gvsig3d.legend.Object3DMarkerSymbol; |
19 |
import com.iver.ai2.gvsig3d.legend.symbols.BaseExtrusionSymbol; |
|
18 | 20 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
19 | 21 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
20 | 22 |
import com.iver.cit.gvsig.fmap.core.symbols.MultiLayerMarkerSymbol; |
... | ... | |
23 | 25 |
public class Point3DFeature extends AbstractFeature3D { |
24 | 26 |
|
25 | 27 |
private Point3DGeometry p3DGeometry; |
26 |
private I3DSymbol p3DSymbol; |
|
28 |
//private I3DSymbol p3DSymbol; |
|
29 |
private Abstract3DSymbol p3DSymbol; |
|
27 | 30 |
|
28 | 31 |
private static Logger logger = Logger.getLogger(Point3DFeature.class |
29 | 32 |
.getName()); |
... | ... | |
33 | 36 |
|
34 | 37 |
p3DGeometry = new Point3DGeometry(geometry); |
35 | 38 |
// p3DSymbol = new SimplePolygon3DSymbol(symbol); |
36 |
if (this.getSymbol().getClass().equals(SimpleMarkerSymbol.class)) { |
|
39 |
|
|
40 |
if (this.getSymbol().getClass().equals(BaseExtrusionSymbol.class)) { |
|
41 |
p3DSymbol = new ExtrusionPoint3DSymbol(symbol); |
|
42 |
} |
|
43 |
else if (this.getSymbol().getClass().equals(SimpleMarkerSymbol.class)) { |
|
37 | 44 |
p3DSymbol = new SimplePoint3DSymbol(symbol); |
38 | 45 |
} else if (this.getSymbol().getClass().equals(PictureMarkerSymbol.class)) { |
39 | 46 |
p3DSymbol = new PicturePoint3DSymbol(symbol); |
trunk/libraries/lib3DMap/src/org/gvsig/gvsig3d/simbology3D/symbol3D/point/ExtrusionPoint3DSymbol.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana. |
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
*/ |
|
19 |
package org.gvsig.gvsig3d.simbology3D.symbol3D.point; |
|
20 |
|
|
21 |
import java.awt.Color; |
|
22 |
import java.util.List; |
|
23 |
|
|
24 |
import org.gvsig.gvsig3d.gui.FeatureFactory; |
|
25 |
import org.gvsig.gvsig3d.simbology3D.symbol3D.Abstract3DSymbol; |
|
26 |
import org.gvsig.osgvp.Node; |
|
27 |
import org.gvsig.osgvp.Vec3; |
|
28 |
import org.gvsig.osgvp.Vec4; |
|
29 |
|
|
30 |
import com.iver.ai2.gvsig3d.legend.symbols.BaseExtrusionSymbol; |
|
31 |
import com.iver.cit.gvsig.fmap.core.symbols.ILineSymbol; |
|
32 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
|
33 |
|
|
34 |
public class ExtrusionPoint3DSymbol extends Abstract3DSymbol{ |
|
35 |
|
|
36 |
|
|
37 |
protected Vec4 rgba ; |
|
38 |
private double extrusion; |
|
39 |
|
|
40 |
public ExtrusionPoint3DSymbol(ISymbol symbol) { |
|
41 |
super(symbol); |
|
42 |
BaseExtrusionSymbol baseExtrusionSymbol = (BaseExtrusionSymbol) symbol; |
|
43 |
|
|
44 |
// ILineSymbol fillSymbol = (ILineSymbol) symbol; |
|
45 |
|
|
46 |
// Getting symbol properties |
|
47 |
|
|
48 |
// Symbol color and alpha value |
|
49 |
Color color = baseExtrusionSymbol.getFillColor(); |
|
50 |
// float alpha = baseExtrusionSymbol.getFillAlpha() / 255f; |
|
51 |
rgba = new Vec4(color.getRed() / 255f, color.getGreen() / 255f, color |
|
52 |
.getBlue() / 255f, 0.7); |
|
53 |
extrusion = baseExtrusionSymbol.getExtrusion(); |
|
54 |
// System.err.println("extrusion " + extrusion); |
|
55 |
} |
|
56 |
|
|
57 |
public Node generateSymbol(List<Vec3> position) { |
|
58 |
// TODO Auto-generated method stub |
|
59 |
// return FeatureFactory.insertPolygon(position, rgba, null); |
|
60 |
//return FeatureFactory.addPointToNode(position,rgba , null,extrusion); |
|
61 |
//return FeatureFactory.addPointToNode(node, newPosition, rgba, (int) size); |
|
62 |
return FeatureFactory.insertPointExtruded(position,rgba , null,extrusion); |
|
63 |
} |
|
64 |
|
|
65 |
} |
trunk/libraries/lib3DMap/src/org/gvsig/gvsig3d/simbology3D/symbol3D/polyline/ExtrusionLine3DSymbol.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana. |
|
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
18 |
*/ |
|
19 |
package org.gvsig.gvsig3d.simbology3D.symbol3D.polyline; |
|
20 |
|
|
21 |
import java.awt.Color; |
|
22 |
import java.util.List; |
|
23 |
|
|
24 |
import org.gvsig.gvsig3d.gui.FeatureFactory; |
|
25 |
import org.gvsig.gvsig3d.simbology3D.symbol3D.Abstract3DSymbol; |
|
26 |
import org.gvsig.osgvp.Node; |
|
27 |
import org.gvsig.osgvp.Vec3; |
|
28 |
import org.gvsig.osgvp.Vec4; |
|
29 |
|
|
30 |
import com.iver.ai2.gvsig3d.legend.symbols.BaseExtrusionSymbol; |
|
31 |
import com.iver.cit.gvsig.fmap.core.symbols.ISymbol; |
|
32 |
|
|
33 |
public class ExtrusionLine3DSymbol extends Abstract3DSymbol{ |
|
34 |
|
|
35 |
protected Vec4 rgba ; |
|
36 |
private double extrusion; |
|
37 |
|
|
38 |
public ExtrusionLine3DSymbol(ISymbol symbol) { |
|
39 |
super(symbol); |
|
40 |
BaseExtrusionSymbol baseExtrusionSymbol = (BaseExtrusionSymbol) symbol; |
|
41 |
|
|
42 |
//ILineSymbol fillSymbol = (ILineSymbol) symbol; |
|
43 |
|
|
44 |
// Getting symbol properties |
|
45 |
|
|
46 |
// Symbol color and alpha value |
|
47 |
Color color = baseExtrusionSymbol.getFillColor(); |
|
48 |
// float alpha = baseExtrusionSymbol.getFillAlpha() / 255f; |
|
49 |
rgba = new Vec4(color.getRed() / 255f, color.getGreen() / 255f, color |
|
50 |
.getBlue() / 255f, 0.7); |
|
51 |
extrusion = baseExtrusionSymbol.getExtrusion(); |
|
52 |
// System.err.println("extrusion " + extrusion); |
|
53 |
} |
|
54 |
|
|
55 |
public Node generateSymbol(List<Vec3> position) { |
|
56 |
// TODO Auto-generated method stub |
|
57 |
// return FeatureFactory.insertPolygon(position, rgba, null); |
|
58 |
return FeatureFactory.insertLineExtruded(position,rgba , null,extrusion); |
|
59 |
} |
|
60 |
|
|
61 |
} |
|
62 |
|
|
63 |
|
Also available in: Unified diff