Revision 29938 branches/v2_0_0_prep/extensions/ext3Dgui/src/org/gvsig/gvsig3dgui/layout/fframe/FFrameView3D.java
FFrameView3D.java | ||
---|---|---|
74 | 74 |
import org.gvsig.app.project.documents.layout.fframes.gui.dialogs.IFFrameDialog; |
75 | 75 |
import org.gvsig.app.project.documents.layout.gui.Layout; |
76 | 76 |
import org.gvsig.app.project.documents.view.ProjectViewBase; |
77 |
import org.gvsig.compat.print.PrintAttributes; |
|
78 |
import org.gvsig.fmap.dal.exception.ReadException; |
|
79 |
import org.gvsig.fmap.geom.Geometry; |
|
80 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
77 | 81 |
import org.gvsig.fmap.geom.primitive.FShape; |
78 | 82 |
import org.gvsig.fmap.mapcontext.MapContext; |
83 |
import org.gvsig.fmap.mapcontext.MapContextException; |
|
79 | 84 |
import org.gvsig.fmap.mapcontext.events.ColorEvent; |
80 | 85 |
import org.gvsig.fmap.mapcontext.events.ExtentEvent; |
81 | 86 |
import org.gvsig.fmap.mapcontext.events.ProjectionEvent; |
... | ... | |
133 | 138 |
public String getClassName() { |
134 | 139 |
return className; |
135 | 140 |
} |
136 |
|
|
141 |
|
|
137 | 142 |
/** |
138 | 143 |
* Devuelve una descripci�n del FFrameView. |
139 | 144 |
* |
... | ... | |
164 | 169 |
* Rect�ngulo a ocupar por el FFrameView. |
165 | 170 |
*/ |
166 | 171 |
public void setNewExtent(Rectangle2D r) { |
167 |
getMapContext().getViewPort().setExtent(r); |
|
172 |
// TODO: COMENTADO para 2.0 |
|
173 |
// getMapContext().getViewPort().setExtent(r); |
|
168 | 174 |
refresh = true; |
169 | 175 |
m_Scale = FLayoutUtilities.getScaleView(getMapContext().getViewPort(), |
170 | 176 |
getBoundBox().width, getBoundingBox(null).width |
... | ... | |
230 | 236 |
public void setView(ProjectViewBase v) { |
231 | 237 |
view = v; |
232 | 238 |
m_fmap = (MapContext3D) v.getMapContext(); |
233 |
if(m_fmap.getCanvas3d() != null) |
|
239 |
if (m_fmap.getCanvas3d() != null)
|
|
234 | 240 |
m_fmap.getCanvas3d().addSlaveComponent(this); |
235 |
|
|
241 |
|
|
236 | 242 |
} |
237 |
|
|
238 |
|
|
239 |
|
|
240 | 243 |
|
241 | 244 |
/** |
242 | 245 |
* Devuelve el modelo de la vista. |
... | ... | |
290 | 293 |
* rect�ngulo sobre el que hacer un clip. |
291 | 294 |
* @param imgBase |
292 | 295 |
* Imagen para acelerar el dibujado. |
296 |
* @throws MapContextException |
|
297 |
* @throws ReadException |
|
293 | 298 |
*/ |
294 | 299 |
public void draw(Graphics2D g, AffineTransform at, Rectangle2D rv, |
295 |
BufferedImage imgBase) throws ReadDriverException {
|
|
300 |
BufferedImage imgBase) { |
|
296 | 301 |
|
297 | 302 |
Rectangle2D.Double r = getBoundingBox(at); |
298 | 303 |
if (getRotation() != 0) |
... | ... | |
353 | 358 |
getMapContext().getViewPort().setImageSize( |
354 | 359 |
new Dimension((int) r.getWidth(), |
355 | 360 |
(int) r.getHeight())); |
356 |
// MapContext3D fmap = (MapContext3D) getMapContext() |
|
357 |
// .cloneToDraw(); |
|
358 |
ViewPort3D viewp =(ViewPort3D)this.getMapContext().getViewPort();//.cloneViewPort(); |
|
361 |
// MapContext3D fmap = (MapContext3D) |
|
362 |
// getMapContext() |
|
363 |
// .cloneToDraw(); |
|
364 |
ViewPort3D viewp = (ViewPort3D) this |
|
365 |
.getMapContext().getViewPort();// .cloneViewPort(); |
|
359 | 366 |
viewp.setImageSize(new Dimension( |
360 | 367 |
getLayout().getWidth(), getLayout() |
361 | 368 |
.getHeight())); |
362 | 369 |
Rectangle2D r1 = calculateExtent(); |
363 | 370 |
double width = getLayout() |
364 |
.getLayoutContext().getAtributes() |
|
371 |
.getLayoutContext().getAttributes()
|
|
365 | 372 |
.getSizeInUnits().getAncho(); |
366 | 373 |
double scale = FLayoutUtilities |
367 | 374 |
.getScaleView(viewp, width, r1 |
... | ... | |
377 | 384 |
.getImageWidth(), viewp |
378 | 385 |
.getImageHeight()); |
379 | 386 |
} |
380 |
getMapContext().draw(imgBase, g, scale); |
|
387 |
try { |
|
388 |
getMapContext().draw(imgBase, g, scale); |
|
389 |
} catch (ReadException e) { |
|
390 |
// TODO Auto-generated catch block |
|
391 |
e.printStackTrace(); |
|
392 |
} catch (MapContextException e) { |
|
393 |
// TODO Auto-generated catch block |
|
394 |
e.printStackTrace(); |
|
395 |
} |
|
381 | 396 |
g.translate(r.getX(), r.getY()); |
382 | 397 |
|
383 | 398 |
} else { |
... | ... | |
393 | 408 |
.getGraphics(); |
394 | 409 |
gimg.translate(-((int) r.getX()), -((int) r |
395 | 410 |
.getY())); |
396 |
getMapContext().draw(m_image, gimg, |
|
397 |
getScale()); |
|
411 |
try { |
|
412 |
getMapContext().draw(m_image, gimg, |
|
413 |
getScale()); |
|
414 |
} catch (ReadException e) { |
|
415 |
// TODO Auto-generated catch block |
|
416 |
e.printStackTrace(); |
|
417 |
} catch (MapContextException e) { |
|
418 |
// TODO Auto-generated catch block |
|
419 |
e.printStackTrace(); |
|
420 |
} |
|
398 | 421 |
gimg.translate(((int) r.getX()), ((int) r |
399 | 422 |
.getY())); |
400 | 423 |
if (theBackColor != null) { |
... | ... | |
443 | 466 |
} |
444 | 467 |
|
445 | 468 |
public void print(Graphics2D g, AffineTransform at, FShape shape, |
446 |
PrintRequestAttributeSet prroperties) throws ReadDriverException {
|
|
469 |
PrintRequestAttributeSet prroperties) throws ReadException { |
|
447 | 470 |
draw(g, at, null, null); |
448 | 471 |
} |
449 | 472 |
|
... | ... | |
460 | 483 |
new Dimension((int) r.width, (int) r.height)); |
461 | 484 |
|
462 | 485 |
Dimension imageSize = this.getMapContext().getViewPort().getImageSize(); |
486 |
// TODO:COMENTADO PARA LA 2.0 |
|
487 |
// try { |
|
488 |
// this.getMapContext().print(g, getScale(), null); |
|
489 |
// } catch (ReadException e) { |
|
490 |
// NotificationManager.addError(e.getMessage(), e); |
|
491 |
// } |
|
463 | 492 |
|
464 |
try { |
|
465 |
this.getMapContext().print(g, getScale(), null); |
|
466 |
} catch (ReadDriverException e) { |
|
467 |
NotificationManager.addError(e.getMessage(), e); |
|
468 |
} |
|
469 |
|
|
470 | 493 |
g.setClip(rclip.x, rclip.y, rclip.width, rclip.height); |
471 |
|
|
472 |
// this.getMapContext().draw( |
|
473 |
// g, |
|
474 |
// (new Rectangle((int) r.getMinX(), (int) r.getMinY(), (int) r |
|
475 |
// .getWidth(), (int) r.getHeight()))); |
|
476 |
// this.getMapContext().draw(image ,g,null,0); |
|
477 |
|
|
478 | 494 |
} |
479 | 495 |
|
480 | 496 |
/** |
... | ... | |
593 | 609 |
|
594 | 610 |
try { |
595 | 611 |
// xml.putProperty("type", Layout.RECTANGLEVIEW); |
596 |
// xml.putProperty("className", this.getClassName());
|
|
597 |
|
|
612 |
// xml.putProperty("className", this.getClassName());
|
|
613 |
|
|
598 | 614 |
xml.putProperty("m_Mode", m_Mode); |
599 | 615 |
xml.putProperty("m_typeScale", m_typeScale); |
600 | 616 |
xml.putProperty("m_extension", m_extension); |
... | ... | |
621 | 637 |
break; |
622 | 638 |
} |
623 | 639 |
} |
624 |
|
|
640 |
|
|
625 | 641 |
} |
626 |
|
|
627 |
// titleWindow = ((ProjectView3D) view).getView().getWindowInfo().getTitle(); |
|
628 |
// xml.putProperty("titleWindow", titleWindow); |
|
629 | 642 |
|
630 | 643 |
if (!hasIndex) { |
631 | 644 |
xml.putProperty("indice", -1); |
... | ... | |
723 | 736 |
this.m_bLinked = xml.getBooleanProperty("m_bLinked"); |
724 | 737 |
this.m_mapUnits = xml.getIntProperty("m_mapUnits"); |
725 | 738 |
|
726 |
// ProjectExtension pe = (ProjectExtension) |
|
727 |
// PluginServices.getExtension(ProjectExtension.class); |
|
728 | 739 |
this.m_Scale = xml.getDoubleProperty("m_Scale"); |
729 | 740 |
|
730 | 741 |
int indice = xml.getIntProperty("indice"); |
... | ... | |
739 | 750 |
|
740 | 751 |
try { |
741 | 752 |
if (m_bLinked) { |
742 |
this.getMapContext().getViewPort().setExtent( |
|
743 |
new Rectangle2D.Double(xml |
|
744 |
.getDoubleProperty("extentX"), xml |
|
745 |
.getDoubleProperty("extentY"), xml |
|
746 |
.getDoubleProperty("extentW"), xml |
|
747 |
.getDoubleProperty("extentH"))); |
|
753 |
// TODO:COMENTADO PARA LA 2.0 |
|
754 |
// this.getMapContext().getViewPort().setExtent( |
|
755 |
// new Rectangle2D.Double(xml |
|
756 |
// .getDoubleProperty("extentX"), xml |
|
757 |
// .getDoubleProperty("extentY"), xml |
|
758 |
// .getDoubleProperty("extentW"), xml |
|
759 |
// .getDoubleProperty("extentH"))); |
|
748 | 760 |
} else if (!m_bLinked) { |
749 |
this.m_fmap = (MapContext3D) MapContext.createFromXML03(xml
|
|
761 |
this.m_fmap = (MapContext3D) MapContext.createFromXML(xml |
|
750 | 762 |
.getChild(0)); |
751 | 763 |
} |
752 | 764 |
} catch (XMLException e) { |
... | ... | |
768 | 780 |
*/ |
769 | 781 |
public void extentChanged(ExtentEvent e) { |
770 | 782 |
if (getTypeScale() == AUTOMATICO) { |
771 |
m_fmap.getViewPort().setExtent(e.getNewExtent()); |
|
783 |
// TODO:COMENTADO PARA LA 2.0 |
|
784 |
// m_fmap.getViewPort().setExtent(e.getNewExtent()); |
|
772 | 785 |
if (getLayout() != null) { |
773 | 786 |
getLayout().getLayoutControl().setStatus( |
774 | 787 |
LayoutControl.DESACTUALIZADO); |
... | ... | |
826 | 839 |
* DOCUMENT ME! |
827 | 840 |
*/ |
828 | 841 |
public void setXMLEntity(XMLEntity xml) { |
829 |
|
|
830 |
// |
|
842 |
|
|
843 |
//
|
|
831 | 844 |
if (xml.getIntProperty("m_Selected") != 0) { |
832 | 845 |
this.setSelected(true); |
833 | 846 |
} else { |
... | ... | |
858 | 871 |
view = (ProjectViewBase) project.getProjectDocumentByName(xml |
859 | 872 |
.getStringProperty("viewName"), |
860 | 873 |
ProjectView3DFactory.registerName); |
861 |
|
|
862 |
// if (xml.contains("className"))
|
|
863 |
// this.className= xml.getStringProperty("className");
|
|
864 |
|
|
874 |
|
|
875 |
// if (xml.contains("className"))
|
|
876 |
// this.className= xml.getStringProperty("className");
|
|
877 |
|
|
865 | 878 |
} else { |
866 | 879 |
if (indice != -1) { |
867 | 880 |
try { |
... | ... | |
877 | 890 |
} |
878 | 891 |
} |
879 | 892 |
|
880 |
// if (xml.contains("titleWindow"))
|
|
881 |
// this.titleWindow = xml.getStringProperty("titleWindow");
|
|
882 |
|
|
893 |
// if (xml.contains("titleWindow"))
|
|
894 |
// this.titleWindow = xml.getStringProperty("titleWindow");
|
|
895 |
|
|
883 | 896 |
if (view != null) { |
884 | 897 |
this.setView(view); |
885 | 898 |
|
886 | 899 |
try { |
887 | 900 |
if (xml.contains("extentX")) { |
888 | 901 |
if (m_bLinked) { |
889 |
this.getMapContext().getViewPort().setExtent( |
|
890 |
new Rectangle2D.Double(xml |
|
891 |
.getDoubleProperty("extentX"), xml |
|
892 |
.getDoubleProperty("extentY"), xml |
|
893 |
.getDoubleProperty("extentW"), xml |
|
894 |
.getDoubleProperty("extentH"))); |
|
902 |
// TODO:COMENTADO PARA LA 2.0 |
|
903 |
// this.getMapContext().getViewPort().setExtent( |
|
904 |
// new Rectangle2D.Double(xml |
|
905 |
// .getDoubleProperty("extentX"), xml |
|
906 |
// .getDoubleProperty("extentY"), xml |
|
907 |
// .getDoubleProperty("extentW"), xml |
|
908 |
// .getDoubleProperty("extentH"))); |
|
895 | 909 |
} else if (!m_bLinked) { |
896 | 910 |
this.m_fmap = (MapContext3D) MapContext |
897 | 911 |
.createFromXML(xml.getChild(0)); |
... | ... | |
968 | 982 |
public void refresh() { |
969 | 983 |
if (view != null |
970 | 984 |
&& (getTypeScale() == MANUAL || getTypeScale() == CONSTANTE)) |
971 |
getMapContext().getViewPort().setExtent(getNewExtent(getScale())); |
|
985 |
// TODO:COMENTADO PARA LA 2.0 |
|
986 |
// getMapContext().getViewPort().setExtent(getNewExtent(getScale())); |
|
972 | 987 |
refresh = true; |
973 | 988 |
} |
974 | 989 |
|
975 |
public void fullExtent() throws ReadDriverException { |
|
976 |
setNewExtent(getMapContext().getFullExtent()); |
|
990 |
public void fullExtent() throws ReadException { |
|
991 |
// TODO:COMENTADO PARA LA 2.0 |
|
992 |
//setNewExtent(getMapContext().getFullExtent()); |
|
977 | 993 |
} |
978 | 994 |
|
979 | 995 |
public void setPointsToZoom(Point2D px1, Point2D px2) { |
... | ... | |
1062 | 1078 |
refresh = true; |
1063 | 1079 |
this.getLayout().getLayoutControl().refresh(); |
1064 | 1080 |
} |
1081 |
|
|
1082 |
public void setNewEnvelope(Envelope r) { |
|
1083 |
// TODO Auto-generated method stub |
|
1084 |
|
|
1085 |
} |
|
1086 |
|
|
1087 |
public void print(Graphics2D g, AffineTransform at, Geometry shape, |
|
1088 |
PrintAttributes properties) { |
|
1089 |
// TODO Auto-generated method stub |
|
1090 |
|
|
1091 |
} |
|
1065 | 1092 |
} |
Also available in: Unified diff