Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
NUI
TULIP-CPS
Commits
46ac8b4a
Commit
46ac8b4a
authored
Nov 09, 2020
by
Nico Mack
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented reverse mode
parent
f91bd55b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
24 deletions
+48
-24
CPS/src/lu/list/itis/dkd/tui/widget/corona/CoxcombSlice.java
CPS/src/lu/list/itis/dkd/tui/widget/corona/CoxcombSlice.java
+46
-24
CPS/src/lu/list/itis/dkd/tui/widget/corona/builder/BaseCoxcombSliceBuilder.java
...kd/tui/widget/corona/builder/BaseCoxcombSliceBuilder.java
+2
-0
No files found.
CPS/src/lu/list/itis/dkd/tui/widget/corona/CoxcombSlice.java
View file @
46ac8b4a
...
@@ -65,6 +65,7 @@ public class CoxcombSlice extends ValueCorona implements InformationProvider<Obj
...
@@ -65,6 +65,7 @@ public class CoxcombSlice extends ValueCorona implements InformationProvider<Obj
protected
String
label
;
protected
String
label
;
protected
boolean
radialLayout
;
protected
boolean
radialLayout
;
protected
boolean
centered
;
protected
boolean
centered
;
protected
boolean
reversed
;
protected
boolean
blinkOnOutOfRange
;
protected
boolean
blinkOnOutOfRange
;
protected
boolean
faceIsTouchable
;
protected
boolean
faceIsTouchable
;
protected
boolean
wrapToFit
;
protected
boolean
wrapToFit
;
...
@@ -93,7 +94,7 @@ public class CoxcombSlice extends ValueCorona implements InformationProvider<Obj
...
@@ -93,7 +94,7 @@ public class CoxcombSlice extends ValueCorona implements InformationProvider<Obj
private
double
normalizedValue
;
private
double
normalizedValue
;
private
double
correctedAngle
;
private
double
correctedAngle
;
private
Area
inner
;
private
Area
stencil
;
private
Area
slice
;
private
Area
slice
;
private
Area
face
;
private
Area
face
;
private
Shape
labelShape
;
private
Shape
labelShape
;
...
@@ -119,9 +120,12 @@ public class CoxcombSlice extends ValueCorona implements InformationProvider<Obj
...
@@ -119,9 +120,12 @@ public class CoxcombSlice extends ValueCorona implements InformationProvider<Obj
this
.
label
=
builder
.
label
;
this
.
label
=
builder
.
label
;
this
.
radialLayout
=
builder
.
radialLayout
;
this
.
radialLayout
=
builder
.
radialLayout
;
this
.
centered
=
builder
.
centered
;
this
.
centered
=
builder
.
centered
;
this
.
reversed
=
builder
.
reversed
;
this
.
innerRadius
=
builder
.
innerRadius
;
this
.
innerRadius
=
builder
.
innerRadius
;
this
.
lowerBoundRadius
=
Math
.
min
(
builder
.
lowerBoundRadius
,
builder
.
upperBoundRadius
);
// this.lowerBoundRadius = Math.min(builder.lowerBoundRadius, builder.upperBoundRadius);
this
.
upperBoundRadius
=
Math
.
max
(
builder
.
lowerBoundRadius
,
builder
.
upperBoundRadius
);
// this.upperBoundRadius = Math.max(builder.lowerBoundRadius, builder.upperBoundRadius);
this
.
lowerBoundRadius
=
builder
.
lowerBoundRadius
;
this
.
upperBoundRadius
=
builder
.
upperBoundRadius
;
this
.
startAngle
=
builder
.
startAngle
;
this
.
startAngle
=
builder
.
startAngle
;
this
.
arcSpan
=
builder
.
arcSpan
;
this
.
arcSpan
=
builder
.
arcSpan
;
this
.
labelAngle
=
builder
.
labelAngle
;
this
.
labelAngle
=
builder
.
labelAngle
;
...
@@ -156,6 +160,7 @@ public class CoxcombSlice extends ValueCorona implements InformationProvider<Obj
...
@@ -156,6 +160,7 @@ public class CoxcombSlice extends ValueCorona implements InformationProvider<Obj
this
.
label
=
original
.
label
;
this
.
label
=
original
.
label
;
this
.
radialLayout
=
original
.
radialLayout
;
this
.
radialLayout
=
original
.
radialLayout
;
this
.
centered
=
original
.
centered
;
this
.
centered
=
original
.
centered
;
this
.
reversed
=
original
.
reversed
;
this
.
innerRadius
=
original
.
innerRadius
;
this
.
innerRadius
=
original
.
innerRadius
;
this
.
lowerBoundRadius
=
original
.
lowerBoundRadius
;
this
.
lowerBoundRadius
=
original
.
lowerBoundRadius
;
this
.
upperBoundRadius
=
original
.
upperBoundRadius
;
this
.
upperBoundRadius
=
original
.
upperBoundRadius
;
...
@@ -269,7 +274,6 @@ public class CoxcombSlice extends ValueCorona implements InformationProvider<Obj
...
@@ -269,7 +274,6 @@ public class CoxcombSlice extends ValueCorona implements InformationProvider<Obj
FontRenderContext
renderingContext
=
new
FontRenderContext
(
null
,
true
,
true
);
FontRenderContext
renderingContext
=
new
FontRenderContext
(
null
,
true
,
true
);
metrics
=
textFont
.
getLineMetrics
(
label
,
renderingContext
);
metrics
=
textFont
.
getLineMetrics
(
label
,
renderingContext
);
List
<
String
>
lines
;
// Java Arc2D start angle and extend are expressed in counter clockwise rotation. Since
// Java Arc2D start angle and extend are expressed in counter clockwise rotation. Since
// TULIP follows the clockwise TUIO convention, we need to convert both startAngle and
// TULIP follows the clockwise TUIO convention, we need to convert both startAngle and
...
@@ -286,10 +290,9 @@ public class CoxcombSlice extends ValueCorona implements InformationProvider<Obj
...
@@ -286,10 +290,9 @@ public class CoxcombSlice extends ValueCorona implements InformationProvider<Obj
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
private
Shape
buildSector
(
double
radius
,
double
diameter
)
{
private
Shape
buildSector
(
double
radius
,
double
diameter
)
{
Shape
sector
=
(
arcSpan
<
AngleUtils
.
THREE_SIXTY
)
return
(
arcSpan
<
AngleUtils
.
THREE_SIXTY
)
?
new
Arc2D
.
Double
(-
radius
,
-
radius
,
diameter
,
diameter
,
correctedAngle
,
arcSpan
,
Arc2D
.
PIE
)
?
new
Arc2D
.
Double
(-
radius
,
-
radius
,
diameter
,
diameter
,
correctedAngle
,
arcSpan
,
Arc2D
.
PIE
)
:
new
Ellipse2D
.
Double
(-
radius
,
-
radius
,
diameter
,
diameter
);
:
new
Ellipse2D
.
Double
(-
radius
,
-
radius
,
diameter
,
diameter
);
return
sector
;
}
}
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
...
@@ -301,24 +304,31 @@ public class CoxcombSlice extends ValueCorona implements InformationProvider<Obj
...
@@ -301,24 +304,31 @@ public class CoxcombSlice extends ValueCorona implements InformationProvider<Obj
correctedAngle
=
AngleUtils
.
moduloThreeSixty
(
AngleUtils
.
THREE_SIXTY
-
startAngle
-
arcSpan
);
correctedAngle
=
AngleUtils
.
moduloThreeSixty
(
AngleUtils
.
THREE_SIXTY
-
startAngle
-
arcSpan
);
diameter
=
2
*
innerRadius
;
diameter
=
2
*
innerRadius
;
inner
=
new
Area
(
new
Ellipse2D
.
Double
(-
innerRadius
,
-
innerRadius
,
diameter
,
diameter
));
stencil
=
new
Area
(
new
Ellipse2D
.
Double
(-
innerRadius
,
-
innerRadius
,
diameter
,
diameter
));
Shape
sector
=
buildSector
(
lowerBoundRadius
,
diameter
);
Shape
sector
=
buildSector
(
lowerBoundRadius
,
diameter
);
Area
sectorArea
=
new
Area
(
sector
);
// Shape sector = (arcSpan < AngleUtils.THREE_SIXTY) ? new Arc2D.Double(-lowerBoundRadius,
if
(
reversed
)
{
// -lowerBoundRadius, diameter, diameter, correctedAngle, arcSpan, Arc2D.PIE);
Area
initial
=
new
Area
(
stencil
);
// : new Ellipse2D.Double(-lowerBoundRadius, -lowerBoundRadius, diameter, diameter);
initial
.
subtract
(
sectorArea
);
shape
=
initial
;
Area
initial
=
new
Area
(
sector
);
}
else
{
initial
.
subtract
(
inner
);
sectorArea
.
subtract
(
stencil
);
shape
=
initial
;
shape
=
sectorArea
;
}
diameter
=
2
*
upperBoundRadius
;
diameter
=
2
*
upperBoundRadius
;
// sector = new Arc2D.Double(-upperBoundRadius, -upperBoundRadius, diameter, diameter,
// correctedAngle, arcSpan, Arc2D.PIE);
sector
=
buildSector
(
upperBoundRadius
,
diameter
);
sector
=
buildSector
(
upperBoundRadius
,
diameter
);
face
=
new
Area
(
sector
);
sectorArea
=
new
Area
(
sector
);
face
.
subtract
(
inner
);
if
(
reversed
)
{
face
=
new
Area
(
stencil
);
face
.
subtract
(
sectorArea
);
}
else
{
face
=
sectorArea
;
face
.
subtract
(
stencil
);
}
int
availableWidth
;
int
availableWidth
;
...
@@ -411,10 +421,13 @@ public class CoxcombSlice extends ValueCorona implements InformationProvider<Obj
...
@@ -411,10 +421,13 @@ public class CoxcombSlice extends ValueCorona implements InformationProvider<Obj
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
public
void
setNormalizedValue
(
double
value
)
{
public
void
setNormalizedValue
(
double
value
)
{
normalizedValue
=
value
;
normalizedValue
=
Math
.
abs
(
value
);
if
(
variable
!=
null
)
{
if
(
variable
!=
null
)
{
double
radius
=
lowerBoundRadius
+
((
upperBoundRadius
-
lowerBoundRadius
)
*
normalizedValue
);
double
radius
=
(
reversed
)
?
lowerBoundRadius
-
((
lowerBoundRadius
-
upperBoundRadius
)
*
normalizedValue
)
:
lowerBoundRadius
+
((
upperBoundRadius
-
lowerBoundRadius
)
*
normalizedValue
);
double
epsilon
=
this
.
variable
.
getEpsilon
();
double
epsilon
=
this
.
variable
.
getEpsilon
();
if
(
this
.
blinkOnOutOfRange
)
{
if
(
this
.
blinkOnOutOfRange
)
{
...
@@ -425,12 +438,21 @@ public class CoxcombSlice extends ValueCorona implements InformationProvider<Obj
...
@@ -425,12 +438,21 @@ public class CoxcombSlice extends ValueCorona implements InformationProvider<Obj
}
}
double
diameter
=
2
*
radius
;
double
diameter
=
2
*
radius
;
// Shape sector = new Arc2D.Double(-radius, -radius, diameter, diameter, correctedAngle,
// arcSpan, Arc2D.PIE);
Shape
sector
=
buildSector
(
radius
,
diameter
);
Shape
sector
=
buildSector
(
radius
,
diameter
);
slice
=
new
Area
(
sector
);
slice
=
new
Area
(
sector
);
slice
.
subtract
(
inner
);
shape
=
slice
;
if
(
reversed
)
{
Area
initial
=
new
Area
(
stencil
);
initial
.
subtract
(
slice
);
shape
=
initial
;
slice
=
initial
;
}
else
{
slice
.
subtract
(
stencil
);
shape
=
slice
;
}
}
}
}
}
...
...
CPS/src/lu/list/itis/dkd/tui/widget/corona/builder/BaseCoxcombSliceBuilder.java
View file @
46ac8b4a
...
@@ -43,6 +43,7 @@ public abstract class BaseCoxcombSliceBuilder<B extends BaseCoxcombSliceBuilder<
...
@@ -43,6 +43,7 @@ public abstract class BaseCoxcombSliceBuilder<B extends BaseCoxcombSliceBuilder<
public
String
label
;
public
String
label
;
public
boolean
radialLayout
;
public
boolean
radialLayout
;
public
boolean
centered
;
public
boolean
centered
;
public
boolean
reversed
;
public
boolean
blinkOnOutOfRange
;
public
boolean
blinkOnOutOfRange
;
public
boolean
faceIsTouchable
;
public
boolean
faceIsTouchable
;
public
boolean
wrapToFit
;
public
boolean
wrapToFit
;
...
@@ -132,6 +133,7 @@ public abstract class BaseCoxcombSliceBuilder<B extends BaseCoxcombSliceBuilder<
...
@@ -132,6 +133,7 @@ public abstract class BaseCoxcombSliceBuilder<B extends BaseCoxcombSliceBuilder<
radialLayout
=
BootstrappingUtils
.
getContentAsBoolean
(
rootElement
,
Externalization
.
RADIAL_LAYOUT_NODE
,
BootstrappingUtils
.
OPTIONAL
,
Boolean
.
FALSE
,
context
);
radialLayout
=
BootstrappingUtils
.
getContentAsBoolean
(
rootElement
,
Externalization
.
RADIAL_LAYOUT_NODE
,
BootstrappingUtils
.
OPTIONAL
,
Boolean
.
FALSE
,
context
);
centered
=
BootstrappingUtils
.
getContentAsBoolean
(
rootElement
,
Externalization
.
CENTRED_NODE
,
BootstrappingUtils
.
OPTIONAL
,
Boolean
.
TRUE
,
context
);
centered
=
BootstrappingUtils
.
getContentAsBoolean
(
rootElement
,
Externalization
.
CENTRED_NODE
,
BootstrappingUtils
.
OPTIONAL
,
Boolean
.
TRUE
,
context
);
reversed
=
BootstrappingUtils
.
getContentAsBoolean
(
rootElement
,
CpsNamespace
.
REVERSED_NODE
,
BootstrappingUtils
.
OPTIONAL
,
Boolean
.
FALSE
,
context
);
cappedDisplay
=
BootstrappingUtils
.
getContentAsBoolean
(
rootElement
,
CpsNamespace
.
CAPPED_DISPLAY_NODE
,
BootstrappingUtils
.
OPTIONAL
,
Boolean
.
FALSE
,
context
);
cappedDisplay
=
BootstrappingUtils
.
getContentAsBoolean
(
rootElement
,
CpsNamespace
.
CAPPED_DISPLAY_NODE
,
BootstrappingUtils
.
OPTIONAL
,
Boolean
.
FALSE
,
context
);
blinkOnOutOfRange
=
BootstrappingUtils
.
getContentAsBoolean
(
rootElement
,
CpsNamespace
.
BLINK_ON_OUT_OF_RANGE_NODE
,
BootstrappingUtils
.
OPTIONAL
,
Boolean
.
FALSE
,
context
);
blinkOnOutOfRange
=
BootstrappingUtils
.
getContentAsBoolean
(
rootElement
,
CpsNamespace
.
BLINK_ON_OUT_OF_RANGE_NODE
,
BootstrappingUtils
.
OPTIONAL
,
Boolean
.
FALSE
,
context
);
faceIsTouchable
=
BootstrappingUtils
.
getContentAsBoolean
(
rootElement
,
CpsNamespace
.
FACE_IS_TOUCHABLE_NODE
,
BootstrappingUtils
.
OPTIONAL
,
Boolean
.
FALSE
,
context
);
faceIsTouchable
=
BootstrappingUtils
.
getContentAsBoolean
(
rootElement
,
CpsNamespace
.
FACE_IS_TOUCHABLE_NODE
,
BootstrappingUtils
.
OPTIONAL
,
Boolean
.
FALSE
,
context
);
...
...
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