Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
The container registry cleanup task is now completed and the registry can be used normally.
Open sidebar
vadere
vadere
Commits
0122c59c
Commit
0122c59c
authored
Oct 10, 2018
by
Benedikt Zoennchen
Browse files
issue
#146
fix view if the viewport=topographyBound.
parent
e38b3d59
Changes
5
Hide whitespace changes
Inline
Side-by-side
VadereGui/src/org/vadere/gui/components/view/DefaultRenderer.java
View file @
0122c59c
...
...
@@ -115,7 +115,7 @@ public abstract class DefaultRenderer {
Rectangle2D
.
Double
viewportBound
=
defaultModel
.
getViewportBound
();
double
dy
=
topographyBound
.
getHeight
()
-
viewportBound
.
getHeight
();
graphics2D
.
translate
(-
viewportBound
.
getX
(),
Math
.
max
((
dy
-
viewportBound
.
getY
()),
0
));
graphics2D
.
translate
(-
viewportBound
.
getX
(),
Math
.
max
((
dy
-
viewportBound
.
getY
()),
-
viewportBound
.
getY
()
));
// graphics2D.translate(+viewportBound.getX(), -Math.max((dy - viewportBound.getY()), 0));
}
...
...
VadereGui/src/org/vadere/gui/topographycreator/control/ActionResizeTopographyBound.java
View file @
0122c59c
...
...
@@ -2,25 +2,23 @@ package org.vadere.gui.topographycreator.control;
import
org.vadere.gui.topographycreator.model.IDrawPanelModel
;
import
org.vadere.gui.topographycreator.model.TopographyCreatorModel
;
import
org.vadere.util.geometry.shapes.VRectangle
;
import
java.awt.event.ActionEvent
;
import
javax.swing.*
;
import
javax.swing.undo.UndoableEditSupport
;
public
class
ActionResizeTopographyBound
extends
TopographyAction
{
private
TopographyAction
action
;
private
final
UndoableEditSupport
undoableEditSupport
;
public
ActionResizeTopographyBound
(
String
name
,
ImageIcon
icon
,
IDrawPanelModel
<?>
panelModel
,
TopographyAction
action
)
{
TopographyAction
action
,
final
UndoableEditSupport
undoSupport
)
{
super
(
name
,
icon
,
panelModel
);
this
.
action
=
action
;
}
public
ActionResizeTopographyBound
(
final
String
name
,
final
IDrawPanelModel
<?>
panelModel
,
TopographyAction
action
)
{
super
(
name
,
panelModel
);
this
.
action
=
action
;
this
.
undoableEditSupport
=
undoSupport
;
}
@Override
...
...
@@ -29,13 +27,13 @@ public class ActionResizeTopographyBound extends TopographyAction {
action
.
actionPerformed
(
e
);
TopographyCreatorModel
model
=
(
TopographyCreatorModel
)
getScenarioPanelModel
();
ActionResizeTopographyBoundDialog
dialog
=
new
ActionResizeTopographyBoundDialog
(
model
.
getTopography
().
getBounds
().
width
,
model
.
getTopography
().
getBounds
().
height
);
ActionResizeTopographyBoundDialog
dialog
=
new
ActionResizeTopographyBoundDialog
(
model
.
getTopographyBound
());
if
(
dialog
.
getValue
()){
model
.
setTopographyBound
(
dialog
.
getBound
());
VRectangle
oldBound
=
new
VRectangle
(
model
.
getTopographyBound
());
VRectangle
newBound
=
new
VRectangle
(
dialog
.
getBound
());
model
.
setTopographyBound
(
newBound
);
undoableEditSupport
.
postEdit
(
new
EditResizeTopographyBound
(
getScenarioPanelModel
(),
oldBound
,
newBound
));
}
getScenarioPanelModel
().
notifyObservers
();
}
...
...
VadereGui/src/org/vadere/gui/topographycreator/control/ActionResizeTopographyBoundDialog.java
View file @
0122c59c
...
...
@@ -4,6 +4,7 @@ import org.vadere.gui.projectview.view.ProjectView;
import
org.vadere.util.geometry.shapes.VRectangle
;
import
java.awt.*
;
import
java.awt.geom.Rectangle2D
;
import
javax.swing.*
;
import
javax.swing.event.DocumentEvent
;
...
...
@@ -12,25 +13,23 @@ import javax.swing.event.DocumentListener;
public
class
ActionResizeTopographyBoundDialog
{
JTextField
textField
;
VRectang
le
bound
;
VRectang
le
boundOld
;
boolean
valid
;
private
JTextField
textField
;
private
Rectangle2D
.
Doub
le
bound
;
private
Rectangle2D
.
Doub
le
boundOld
;
private
boolean
valid
;
public
ActionResizeTopographyBoundDialog
(
double
width
,
double
height
){
public
ActionResizeTopographyBoundDialog
(
final
Rectangle2D
.
Double
topographyBound
){
textField
=
new
JTextField
();
textField
.
setText
(
String
.
format
(
"%.3f x %.3f"
,
width
,
h
eight
));
textField
.
setText
(
String
.
format
(
"%.3f x %.3f"
,
topographyBound
.
getWidth
(),
topographyBound
.
getH
eight
()
));
textField
.
getDocument
().
addDocumentListener
(
new
DialogListener
());
bound
=
new
VRectangle
(
0.0
,
0.0
,
width
,
height
)
;
boundOld
=
new
VRectangle
(
0.0
,
0.0
,
width
,
height
)
;
bound
=
topographyBound
;
boundOld
=
topographyBound
;
valid
=
false
;
}
public
V
Rectangle
getBound
()
{
public
Rectangle
2D
.
Double
getBound
()
{
return
valid
?
bound
:
boundOld
;
}
...
...
@@ -44,8 +43,8 @@ public class ActionResizeTopographyBoundDialog {
private
class
DialogListener
implements
DocumentListener
{
JTextField
textField
;
String
text
;
private
JTextField
textField
;
private
String
text
;
DialogListener
(){
textField
=
ActionResizeTopographyBoundDialog
.
this
.
textField
;
...
...
@@ -75,8 +74,10 @@ public class ActionResizeTopographyBoundDialog {
try
{
width
=
Double
.
valueOf
(
tmp
[
0
]);
height
=
Double
.
valueOf
(
tmp
[
1
]);
ActionResizeTopographyBoundDialog
.
this
.
bound
=
new
VRectangle
(
0.0
,
0.0
,
width
,
height
);
new
Rectangle2D
.
Double
(
ActionResizeTopographyBoundDialog
.
this
.
boundOld
.
getMinX
(),
ActionResizeTopographyBoundDialog
.
this
.
boundOld
.
getMinY
(),
width
,
height
);
ActionResizeTopographyBoundDialog
.
this
.
valid
=
true
;
textField
.
setForeground
(
Color
.
BLACK
);
}
catch
(
Exception
ex
){
...
...
VadereGui/src/org/vadere/gui/topographycreator/control/EditResizeTopographyBound.java
0 → 100644
View file @
0122c59c
package
org.vadere.gui.topographycreator.control
;
import
org.vadere.gui.topographycreator.model.IDrawPanelModel
;
import
org.vadere.util.geometry.shapes.VRectangle
;
import
javax.swing.undo.AbstractUndoableEdit
;
import
javax.swing.undo.CannotRedoException
;
import
javax.swing.undo.CannotUndoException
;
/**
* @author Benedikt Zoennchen
*/
public
class
EditResizeTopographyBound
extends
AbstractUndoableEdit
{
private
static
final
long
serialVersionUID
=
5176192525116057658L
;
private
final
IDrawPanelModel
panelModel
;
private
final
VRectangle
oldBound
;
private
final
VRectangle
newBound
;
public
EditResizeTopographyBound
(
final
IDrawPanelModel
panelModel
,
final
VRectangle
oldBound
,
final
VRectangle
newBound
)
{
this
.
panelModel
=
panelModel
;
this
.
oldBound
=
oldBound
;
this
.
newBound
=
newBound
;
}
@Override
public
void
undo
()
throws
CannotUndoException
{
panelModel
.
setTopographyBound
(
oldBound
);
}
@Override
public
void
redo
()
throws
CannotRedoException
{
panelModel
.
setTopographyBound
(
newBound
);
}
@Override
public
boolean
canUndo
()
{
return
true
;
}
@Override
public
boolean
canRedo
()
{
return
true
;
}
@Override
public
String
getPresentationName
()
{
return
"resize topography bound"
;
}
}
VadereGui/src/org/vadere/gui/topographycreator/view/TopographyWindow.java
View file @
0122c59c
...
...
@@ -300,7 +300,11 @@ public class TopographyWindow extends JPanel {
/* resize Topography */
TopographyAction
resizeTopographyBound
=
new
ActionResizeTopographyBound
(
"SetTopograpyBound"
,
new
ImageIcon
(
Resources
.
class
.
getResource
(
"/icons/topography_icon.png"
)),
panelModel
,
selectShape
);
panelModel
,
selectShape
,
undoSupport
);
/*TopographyAction translateTopographyBound =new ActionResizeTopographyBound("SetTopograpyBound",
new ImageIcon(Resources.class.getResource("/icons/topography_icon.png")),
panelModel, selectShape, undoSupport);*/
/* Makros */
ActionTopographyMakroMenu
actionTopographyMakroMenu
=
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment