Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
TULIP-CPS
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
NUI
TULIP-CPS
Commits
17119bca
Commit
17119bca
authored
Nov 17, 2017
by
Nico Mack
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modified scaling strategy
parent
f0c73390
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
24 deletions
+12
-24
CPS/src/lu/list/itis/dkd/tui/widget/corona/ShapeGraph.java
CPS/src/lu/list/itis/dkd/tui/widget/corona/ShapeGraph.java
+12
-24
No files found.
CPS/src/lu/list/itis/dkd/tui/widget/corona/ShapeGraph.java
View file @
17119bca
...
@@ -45,7 +45,7 @@ public class ShapeGraph extends ValueCorona {
...
@@ -45,7 +45,7 @@ public class ShapeGraph extends ValueCorona {
protected
ColorPair
fillColour
;
protected
ColorPair
fillColour
;
protected
ColorPair
strokeColour
;
protected
ColorPair
strokeColour
;
protected
int
strokeWidth
;
protected
int
strokeWidth
;
// protected Shape graph
Shape;
protected
Shape
scaled
Shape
;
protected
Timeline
blinkingTimeline
;
protected
Timeline
blinkingTimeline
;
protected
Timeline
balisticTimeline
;
protected
Timeline
balisticTimeline
;
...
@@ -71,6 +71,7 @@ public class ShapeGraph extends ValueCorona {
...
@@ -71,6 +71,7 @@ public class ShapeGraph extends ValueCorona {
this
.
strokeColour
=
builder
.
strokeColour
;
this
.
strokeColour
=
builder
.
strokeColour
;
this
.
strokeWidth
=
builder
.
strokeWidth
;
this
.
strokeWidth
=
builder
.
strokeWidth
;
this
.
shape
=
builder
.
graphShape
;
this
.
shape
=
builder
.
graphShape
;
this
.
scaledShape
=
builder
.
shape
;
borderStroke
=
(
builder
.
strokeWidth
>
0
)
?
new
BasicStroke
(
builder
.
strokeWidth
)
:
null
;
borderStroke
=
(
builder
.
strokeWidth
>
0
)
?
new
BasicStroke
(
builder
.
strokeWidth
)
:
null
;
...
@@ -95,6 +96,7 @@ public class ShapeGraph extends ValueCorona {
...
@@ -95,6 +96,7 @@ public class ShapeGraph extends ValueCorona {
this
.
strokeColour
=
original
.
strokeColour
;
this
.
strokeColour
=
original
.
strokeColour
;
this
.
strokeWidth
=
original
.
strokeWidth
;
this
.
strokeWidth
=
original
.
strokeWidth
;
this
.
shape
=
original
.
shape
;
this
.
shape
=
original
.
shape
;
this
.
scaledShape
=
original
.
shape
;
borderStroke
=
(
original
.
strokeWidth
>
0
)
?
new
BasicStroke
(
original
.
strokeWidth
)
:
null
;
borderStroke
=
(
original
.
strokeWidth
>
0
)
?
new
BasicStroke
(
original
.
strokeWidth
)
:
null
;
...
@@ -135,7 +137,9 @@ public class ShapeGraph extends ValueCorona {
...
@@ -135,7 +137,9 @@ public class ShapeGraph extends ValueCorona {
shownValue
=
value
;
shownValue
=
value
;
if
(
variable
!=
null
)
{
if
(
variable
!=
null
)
{
double
size
=
lowerBound
+
(
upperBound
-
lowerBound
)
*
(
shownValue
-
this
.
variable
.
getMinValue
())
/
(
this
.
variable
.
getMaxValue
()
-
this
.
variable
.
getMinValue
());
// double size = lowerBound + (upperBound - lowerBound) * (shownValue - this.variable.getMinValue())
// / (this.variable.getMaxValue() - this.variable.getMinValue());
double
size
=
lowerBound
+
((
upperBound
-
lowerBound
)
*
this
.
variable
.
getNormalizedValue
());
if
(
size
==
upperBound
)
if
(
size
==
upperBound
)
this
.
startBlinking
();
this
.
startBlinking
();
...
@@ -143,6 +147,9 @@ public class ShapeGraph extends ValueCorona {
...
@@ -143,6 +147,9 @@ public class ShapeGraph extends ValueCorona {
this
.
stopBlinking
();
this
.
stopBlinking
();
scale
=
size
/
lowerBound
;
scale
=
size
/
lowerBound
;
AffineTransform
scaler
=
AffineTransform
.
getScaleInstance
(
scale
,
scale
);
scaledShape
=
scaler
.
createTransformedShape
(
this
.
shape
);
}
}
}
}
...
@@ -150,9 +157,7 @@ public class ShapeGraph extends ValueCorona {
...
@@ -150,9 +157,7 @@ public class ShapeGraph extends ValueCorona {
@Override
@Override
public
Shape
getShape
()
{
public
Shape
getShape
()
{
AffineTransform
transform
=
this
.
getTransform
(
null
);
return
this
.
scaledShape
;
transform
.
scale
(
scale
,
scale
);
return
transform
.
createTransformedShape
(
super
.
getShape
());
}
}
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
...
@@ -164,24 +169,7 @@ public class ShapeGraph extends ValueCorona {
...
@@ -164,24 +169,7 @@ public class ShapeGraph extends ValueCorona {
Graphics2D
localCanvas
=
(
Graphics2D
)
canvas
.
create
();
Graphics2D
localCanvas
=
(
Graphics2D
)
canvas
.
create
();
// centre.toScreenCoordinates();
// if (initialTranslation != null)
// initialTranslation.toScreenCoordinates();
// Point drawAt = centre.add(initialTranslation);
//
// if (this.rotateWithHandle) {
// angle = (float) (drawAt.getAngle() % TWO_PI);
// }
//
// AffineTransform translation = new AffineTransform();
// translation.translate(drawAt.x, drawAt.y);
// translation.rotate(angle);
// translation.scale(scale, scale);
// localCanvas.setTransform(translation);
AffineTransform
transform
=
this
.
getTransform
(
null
);
AffineTransform
transform
=
this
.
getTransform
(
null
);
transform
.
scale
(
scale
,
scale
);
localCanvas
.
setTransform
(
transform
);
localCanvas
.
setTransform
(
transform
);
if
(
this
.
opacity
<
1.0f
)
if
(
this
.
opacity
<
1.0f
)
...
@@ -190,14 +178,14 @@ public class ShapeGraph extends ValueCorona {
...
@@ -190,14 +178,14 @@ public class ShapeGraph extends ValueCorona {
if
(
shape
!=
null
)
{
if
(
shape
!=
null
)
{
if
(
fillColour
!=
null
)
{
if
(
fillColour
!=
null
)
{
localCanvas
.
setPaint
(
fillColour
.
getColor
());
localCanvas
.
setPaint
(
fillColour
.
getColor
());
localCanvas
.
fill
(
shape
);
localCanvas
.
fill
(
s
caledS
hape
);
}
}
if
(
strokeColour
!=
null
)
{
if
(
strokeColour
!=
null
)
{
localCanvas
.
setPaint
(
strokeColour
.
getColor
());
localCanvas
.
setPaint
(
strokeColour
.
getColor
());
if
(
borderStroke
!=
null
)
{
if
(
borderStroke
!=
null
)
{
localCanvas
.
setStroke
(
borderStroke
);
localCanvas
.
setStroke
(
borderStroke
);
localCanvas
.
draw
(
shape
);
localCanvas
.
draw
(
s
caledS
hape
);
}
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
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