[Nextobjects-devel] nextobjects/nextobjects/src/org/devaki/nextobjects/util NOImageTransform.java,1.
Status: Alpha
Brought to you by:
eflorent
|
From: <efl...@us...> - 2003-06-04 19:30:15
|
Update of /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/util
In directory sc8-pr-cvs1:/tmp/cvs-serv8358/src/org/devaki/nextobjects/util
Modified Files:
NOImageTransform.java
Log Message:
Refactored graphics-
Index: NOImageTransform.java
===================================================================
RCS file: /cvsroot/nextobjects/nextobjects/nextobjects/src/org/devaki/nextobjects/util/NOImageTransform.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** NOImageTransform.java 3 Jun 2003 18:00:54 -0000 1.5
--- NOImageTransform.java 4 Jun 2003 19:29:40 -0000 1.6
***************
*** 29,32 ****
--- 29,33 ----
import org.apache.log4j.Category;
import org.apache.log4j.Logger;
+ import org.devaki.nextobjects.workspace.models.BaseModel;
import org.devaki.nextobjects.workspace.models.PhysicalModel;
import org.devaki.nextobjects.workspace.models.ConceptualModel;
***************
*** 57,89 ****
/**
! * Move the ConceptualModel to the upper left corner to get the samllest image.
! * @param pCDM the context model
! * @param xOffset the X offset
! * @param yOffset the Y offset
! */
! private static void translateModel(
! ConceptualModel pCDM,
! int xOffset,
! int yOffset)
! {
! BaseObject[] tmp = pCDM.getModel0bjects();
!
! // loop
! for (int j = 0; j < tmp.length; j++)
! {
! if (tmp[j].getObjectView() instanceof ClassView)
! {
! ((ClassView) tmp[j].getObjectView()).setLocation(
! new Point(
! tmp[j].getObjectView().getLocation().x - xOffset,
! tmp[j].getObjectView().getLocation().y - yOffset));
! tmp[j].getObjectView().resetSelectionPoint();
! }
! }
!
! }
!
! /**
! * Move the PhysicalModel to the upper left corner to get the samllest image.
* @param pPDM the context model
* @param xOffset the X offset
--- 58,63 ----
/**
! * Move the model to the upper left corner to get the samllest image.
! *
* @param pPDM the context model
* @param xOffset the X offset
***************
*** 91,100 ****
*/
private static void translateModel(
! PhysicalModel pPDM,
int xOffset,
int yOffset)
{
! Rectangle rect = pPDM.getRectangle();
! BaseObject[] tmp = pPDM.getModel0bjects();
// loop
for (int j = 0; j < tmp.length; j++)
--- 65,73 ----
*/
private static void translateModel(
! BaseModel pPDM,
int xOffset,
int yOffset)
{
! BaseObject[] tmp = pPDM.getModelObjects();
// loop
for (int j = 0; j < tmp.length; j++)
***************
*** 102,106 ****
if (tmp[j].getObjectView() instanceof ClassView)
{
-
((ClassView) tmp[j].getObjectView()).setLocation(
new Point(
--- 75,78 ----
***************
*** 110,114 ****
}
}
- pPDM.calculateRectangle();
}
--- 82,85 ----
***************
*** 145,149 ****
boolean success = false;
! Point oldP = pCDM.getRectangle().getLocation();
// this is a hack, the model is moved to top left corner in
// order to avoid drawing the whole 5000*5000 drawingArea.
--- 116,120 ----
boolean success = false;
! Point oldP = pCDM.getConceptualView().getRectangle().getLocation();
// this is a hack, the model is moved to top left corner in
// order to avoid drawing the whole 5000*5000 drawingArea.
***************
*** 151,156 ****
// by that time it havn't been redrawed ...
translateModel(pCDM, oldP.x, oldP.y);
// the rectangle give the offfset.
! Rectangle rect = pCDM.getRectangle();
pCDM.getConceptualView().setFullRefresh(true);
BufferedImage bi =
--- 122,130 ----
// by that time it havn't been redrawed ...
translateModel(pCDM, oldP.x, oldP.y);
+ pCDM.getConceptualView().calculateRectangle();
+ pCDM.getConceptualView().setFullRefresh(true);
+
// the rectangle give the offfset.
! Rectangle rect = pCDM.getConceptualView().getRectangle();
pCDM.getConceptualView().setFullRefresh(true);
BufferedImage bi =
***************
*** 170,173 ****
--- 144,150 ----
}
translateModel(pCDM, -oldP.x, -oldP.y);
+ pCDM.getConceptualView().calculateRectangle();
+ pCDM.getConceptualView().setFullRefresh(true);
+ pCDM.getConceptualView().repaint();
pCDM.getConceptualView().repaint();
return success;
***************
*** 184,188 ****
boolean success = false;
! Point oldP = pPDM.getRectangle().getLocation();
// this is a hack, the model is moved to top left corner in
// order to avoid drawing the whole 5000*5000 drawingArea.
--- 161,165 ----
boolean success = false;
! Point oldP = pPDM.getPhysicalView().getRectangle().getLocation();
// this is a hack, the model is moved to top left corner in
// order to avoid drawing the whole 5000*5000 drawingArea.
***************
*** 190,195 ****
// by that time it havn't been redrawed ...
translateModel(pPDM, oldP.x, oldP.y);
// the rectangle give the offfset.
! Rectangle rect = pPDM.getRectangle();
try
--- 167,174 ----
// by that time it havn't been redrawed ...
translateModel(pPDM, oldP.x, oldP.y);
+ pPDM.getPhysicalView().calculateRectangle();
+ pPDM.getPhysicalView().setFullRefresh(true);
// the rectangle give the offfset.
! Rectangle rect = pPDM.getPhysicalView().getRectangle();
try
***************
*** 210,213 ****
--- 189,194 ----
// return to the old offset.
translateModel(pPDM, -oldP.x, -oldP.y);
+ pPDM.getPhysicalView().calculateRectangle();
+ pPDM.getPhysicalView().setFullRefresh(true);
pPDM.getPhysicalView().repaint();
|