Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
b32d1950
Commit
b32d1950
authored
Jul 18, 2007
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Select next object function improved
parent
26bbbab0
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
515 additions
and
161 deletions
+515
-161
wb/lib/wb/src/wb_gre.cpp
wb/lib/wb/src/wb_gre.cpp
+28
-13
xtt/lib/flow/src/flow.h
xtt/lib/flow/src/flow.h
+4
-2
xtt/lib/flow/src/flow_api.cpp
xtt/lib/flow/src/flow_api.cpp
+6
-1
xtt/lib/flow/src/flow_api.h
xtt/lib/flow/src/flow_api.h
+2
-1
xtt/lib/flow/src/flow_ctx.cpp
xtt/lib/flow/src/flow_ctx.cpp
+202
-56
xtt/lib/flow/src/flow_ctx.h
xtt/lib/flow/src/flow_ctx.h
+4
-3
xtt/lib/ge/src/ge_graph.cpp
xtt/lib/ge/src/ge_graph.cpp
+29
-15
xtt/lib/glow/src/glow.h
xtt/lib/glow/src/glow.h
+14
-5
xtt/lib/glow/src/glow_growapi.cpp
xtt/lib/glow/src/glow_growapi.cpp
+6
-1
xtt/lib/glow/src/glow_growapi.h
xtt/lib/glow/src/glow_growapi.h
+2
-1
xtt/lib/glow/src/glow_growctx.cpp
xtt/lib/glow/src/glow_growctx.cpp
+214
-62
xtt/lib/glow/src/glow_growctx.h
xtt/lib/glow/src/glow_growctx.h
+4
-1
No files found.
wb/lib/wb/src/wb_gre.cpp
View file @
b32d1950
/*
* Proview $Id: wb_gre.cpp,v 1.
4 2007-07-17 12:44:44
claes Exp $
* Proview $Id: wb_gre.cpp,v 1.
5 2007-07-18 09:27:16
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -3032,19 +3032,34 @@ void WGre::select_nextobject( flow_eDirection dir)
int
sts
;
flow_GetSelectedNodes
(
flow_ctx
,
&
fnode_list
,
&
fnode_count
);
if
(
fnode_count
!=
1
)
{
message
(
"Select one object"
);
return
;
}
sel
=
fnode_list
[
0
];
if
(
fnode_count
==
0
)
sel
=
0
;
else
sel
=
fnode_list
[
0
];
sts
=
flow_GetNextObject
(
flow_ctx
,
sel
,
dir
,
&
next
);
if
(
EVEN
(
sts
))
{
message
(
"Unable to find next object"
);
return
;
if
(
!
sel
||
!
flow_IsVisible
(
flow_ctx
,
sel
,
flow_eVisible_Partial
))
{
sts
=
flow_GetNextObject
(
flow_ctx
,
0
,
dir
,
&
next
);
if
(
EVEN
(
sts
))
{
message
(
"Unable to find a visible object"
);
return
;
}
flow_SelectClear
(
flow_ctx
);
flow_SetHighlight
(
next
,
1
);
flow_SelectInsert
(
flow_ctx
,
next
);
}
else
{
sts
=
flow_GetNextObject
(
flow_ctx
,
sel
,
dir
,
&
next
);
if
(
EVEN
(
sts
))
{
message
(
"Unable to find next object"
);
return
;
}
flow_SelectClear
(
flow_ctx
);
flow_SetHighlight
(
next
,
1
);
flow_SelectInsert
(
flow_ctx
,
next
);
flow_SelectClear
(
flow_ctx
);
flow_SetHighlight
(
next
,
1
);
flow_SelectInsert
(
flow_ctx
,
next
);
if
(
!
flow_IsVisible
(
flow_ctx
,
next
,
flow_eVisible_Full
))
flow_CenterObject
(
flow_ctx
,
next
);
}
}
xtt/lib/flow/src/flow.h
View file @
b32d1950
/*
* Proview $Id: flow.h,v 1.1
2 2007-05-11 15:07:21
claes Exp $
* Proview $Id: flow.h,v 1.1
3 2007-07-18 09:26:43
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -73,7 +73,9 @@ typedef enum {
flow_eVisible_Full
,
flow_eVisible_Partial
,
flow_eVisible_Top
,
flow_eVisible_Bottom
flow_eVisible_Bottom
,
flow_eVisible_Right
,
flow_eVisible_Left
}
flow_eVisible
;
typedef
enum
{
...
...
xtt/lib/flow/src/flow_api.cpp
View file @
b32d1950
/*
* Proview $Id: flow_api.cpp,v 1.
9 2007-07-17 12:40:50
claes Exp $
* Proview $Id: flow_api.cpp,v 1.
10 2007-07-18 09:26:43
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -698,3 +698,8 @@ int flow_GetNextObject( flow_tCtx ctx, flow_tNode object, flow_eDirection dir,
return
ctx
->
get_next_object
(
(
FlowArrayElem
*
)
object
,
dir
,
(
FlowArrayElem
**
)
next
);
}
int
flow_IsVisible
(
flow_tCtx
ctx
,
flow_tObject
object
,
flow_eVisible
type
)
{
return
ctx
->
is_visible
(
(
FlowArrayElem
*
)
object
,
type
);
}
xtt/lib/flow/src/flow_api.h
View file @
b32d1950
/*
* Proview $Id: flow_api.h,v 1.
9 2007-07-17 12:40:50
claes Exp $
* Proview $Id: flow_api.h,v 1.
10 2007-07-18 09:26:43
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -237,6 +237,7 @@ void flow_SetClickSensitivity( flow_tCtx ctx, int value);
void
flow_SetNoConObstacle
(
flow_tNodeClass
nc
,
int
no_obstacle
);
int
flow_GetNextObject
(
flow_tCtx
ctx
,
flow_tNode
object
,
flow_eDirection
dir
,
flow_tNode
*
next
);
int
flow_IsVisible
(
flow_tCtx
ctx
,
flow_tObject
object
,
flow_eVisible
type
);
#if defined __cplusplus
}
...
...
xtt/lib/flow/src/flow_ctx.cpp
View file @
b32d1950
/*
* Proview $Id: flow_ctx.cpp,v 1.1
0 2007-07-17 12:40:50
claes Exp $
* Proview $Id: flow_ctx.cpp,v 1.1
1 2007-07-18 09:26:43
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -1661,77 +1661,156 @@ int FlowCtx::radiobutton_cb( FlowArrayElem *object, int number,
int
FlowCtx
::
get_next_object
(
FlowArrayElem
*
object
,
flow_eDirection
dir
,
FlowArrayElem
**
next
)
{
if
(
object
->
type
()
!=
flow_eObjectType_Node
)
if
(
object
&&
object
->
type
()
!=
flow_eObjectType_Node
)
return
0
;
double
ll_x
,
ll_y
,
ur_x
,
ur_y
;
double
a_ll_x
,
a_ll_y
,
a_ur_x
,
a_ur_y
;
double
x
,
y
,
a_x
,
a_y
;
double
dir_angle
;
vector
<
NextElem
>
a0
;
((
FlowNode
*
)
object
)
->
measure
(
&
ll_x
,
&
ll_y
,
&
ur_x
,
&
ur_y
);
x
=
(
ll_x
+
ur_x
)
/
2
;
y
=
(
ll_y
+
ur_y
)
/
2
;
switch
(
dir
)
{
case
flow_eDirection_Left
:
dir_angle
=
M_PI
;
break
;
case
flow_eDirection_Right
:
dir_angle
=
0
;
break
;
case
flow_eDirection_Up
:
dir_angle
=
-
M_PI
/
2
;
break
;
case
flow_eDirection_Down
:
dir_angle
=
M_PI
/
2
;
break
;
default:
;
if
(
!
object
)
{
// Chose a visible object
double
window_x_low
,
window_x_high
;
double
window_y_low
,
window_y_high
;
window_x_low
=
double
(
offset_x
)
/
zoom_factor
;
window_x_high
=
double
(
offset_x
+
window_width
)
/
zoom_factor
;
window_y_low
=
double
(
offset_y
)
/
zoom_factor
;
window_y_high
=
double
(
offset_y
+
window_height
)
/
zoom_factor
;
for
(
int
i
=
0
;
i
<
a
.
size
();
i
++
)
{
if
(
a
[
i
]
->
type
()
==
flow_eObjectType_Node
)
{
NextElem
n
;
((
FlowNode
*
)
a
[
i
])
->
measure
(
&
a_ll_x
,
&
a_ll_y
,
&
a_ur_x
,
&
a_ur_y
);
if
(
a_ll_x
>=
window_x_low
&&
a_ur_x
<=
window_x_high
&&
a_ll_y
>=
window_y_low
&&
a_ur_y
<=
window_y_high
)
{
// Fully visible
switch
(
dir
)
{
case
flow_eDirection_Left
:
n
.
rank
=
(
window_x_high
-
a_ur_x
)
/
(
window_x_high
-
window_x_low
);
break
;
case
flow_eDirection_Right
:
n
.
rank
=
(
a_ll_x
-
window_x_low
)
/
(
window_x_high
-
window_x_low
);
break
;
case
flow_eDirection_Up
:
n
.
rank
=
(
window_y_high
-
a_ur_y
)
/
(
window_y_high
-
window_y_low
);
break
;
case
flow_eDirection_Down
:
n
.
rank
=
(
a_ll_y
-
window_y_low
)
/
(
window_y_high
-
window_y_low
);
break
;
default:
;
}
n
.
elem
=
a
[
i
];
a0
.
push_back
(
n
);
}
else
if
(
((
a_ll_y
>=
window_y_low
&&
a_ll_y
<=
window_y_high
)
||
(
a_ur_y
>=
window_y_low
&&
a_ur_y
<=
window_y_high
)
||
(
a_ll_y
<=
window_y_low
&&
a_ur_y
>=
window_y_high
))
&&
((
a_ll_x
>=
window_x_low
&&
a_ll_x
<=
window_x_high
)
||
(
a_ur_x
>=
window_x_low
&&
a_ur_x
<=
window_x_high
)
||
(
a_ll_x
<=
window_x_low
&&
a_ur_x
>=
window_x_high
)))
{
// Partially visible
switch
(
dir
)
{
case
flow_eDirection_Left
:
n
.
rank
=
(
window_x_high
-
a_ur_x
)
/
(
window_x_high
-
window_x_low
)
+
10
;
break
;
case
flow_eDirection_Right
:
n
.
rank
=
(
a_ll_x
-
window_x_low
)
/
(
window_x_high
-
window_x_low
)
+
10
;
break
;
case
flow_eDirection_Up
:
n
.
rank
=
(
window_y_high
-
a_ur_y
)
/
(
window_y_high
-
window_y_low
)
+
10
;
break
;
case
flow_eDirection_Down
:
n
.
rank
=
(
a_ll_y
-
window_y_low
)
/
(
window_y_high
-
window_y_low
)
+
10
;
break
;
default:
;
}
n
.
elem
=
a
[
i
];
a0
.
push_back
(
n
);
}
}
}
if
(
a0
.
size
()
==
0
)
return
0
;
}
else
{
((
FlowNode
*
)
object
)
->
measure
(
&
ll_x
,
&
ll_y
,
&
ur_x
,
&
ur_y
);
x
=
ll_x
;
y
=
ll_y
;
switch
(
dir
)
{
case
flow_eDirection_Left
:
dir_angle
=
M_PI
;
break
;
case
flow_eDirection_Right
:
dir_angle
=
0
;
break
;
case
flow_eDirection_Up
:
dir_angle
=
-
M_PI
/
2
;
break
;
case
flow_eDirection_Down
:
dir_angle
=
M_PI
/
2
;
break
;
default:
;
}
for
(
int
i
=
0
;
i
<
a
.
size
();
i
++
)
{
if
(
a
[
i
]
==
object
)
continue
;
vector
<
NextElem
>
a0
;
for
(
int
i
=
0
;
i
<
a
.
size
();
i
++
)
{
if
(
a
[
i
]
==
object
)
continue
;
if
(
a
[
i
]
->
type
()
==
flow_eObjectType_Node
)
{
if
(
a
[
i
]
->
type
()
==
flow_eObjectType_Node
)
{
((
FlowNode
*
)
a
[
i
])
->
measure
(
&
a_ll_x
,
&
a_ll_y
,
&
a_ur_x
,
&
a_ur_y
);
if
(
ll_x
>=
a_ll_x
&&
ur_x
<=
a_ur_x
&&
ll_y
>=
a_ll_y
&&
ur_y
<=
a_ur_y
)
continue
;
a_x
=
(
a_ll_x
+
a_ur_x
)
/
2
;
a_y
=
(
a_ll_y
+
a_ur_y
)
/
2
;
NextElem
n
;
n
.
elem
=
a
[
i
];
n
.
distance
=
sqrt
((
a_x
-
x
)
*
(
a_x
-
x
)
+
(
a_y
-
y
)
*
(
a_y
-
y
));
if
(
fabs
(
a_y
-
y
)
<
DBL_EPSILON
)
{
if
(
a_x
>
x
)
n
.
angle
=
0
;
else
n
.
angle
=
M_PI
;
}
else
{
n
.
angle
=
atan
((
a_x
-
x
)
/
(
a_y
-
y
))
+
M_PI
/
2
;
if
(
(
a_y
-
y
)
>
0
)
n
.
angle
-=
M_PI
;
((
FlowNode
*
)
a
[
i
])
->
measure
(
&
a_ll_x
,
&
a_ll_y
,
&
a_ur_x
,
&
a_ur_y
);
if
(
ll_x
>=
a_ll_x
&&
ur_x
<=
a_ur_x
&&
ll_y
>=
a_ll_y
&&
ur_y
<=
a_ur_y
)
continue
;
a_x
=
a_ll_x
;
a_y
=
a_ll_y
;
NextElem
n
;
n
.
elem
=
a
[
i
];
n
.
distance
=
sqrt
((
a_x
-
x
)
*
(
a_x
-
x
)
+
(
a_y
-
y
)
*
(
a_y
-
y
));
if
(
fabs
(
a_y
-
y
)
<
DBL_EPSILON
)
{
if
(
a_x
>
x
)
n
.
angle
=
0
;
else
n
.
angle
=
M_PI
;
}
else
{
n
.
angle
=
atan
((
a_x
-
x
)
/
(
a_y
-
y
))
+
M_PI
/
2
;
if
(
(
a_y
-
y
)
>
0
)
n
.
angle
-=
M_PI
;
}
double
rank_angel
=
n
.
angle
+
dir_angle
;
double
rank_distance
=
n
.
distance
/
(
x_right
-
x_left
);
if
(
rank_angel
>
M_PI
)
rank_angel
-=
2
*
M_PI
;
rank_angel
=
fabs
(
rank_angel
)
/
M_PI
;
if
(
rank_angel
>
0.5
)
continue
;
n
.
rank
=
rank_angel
+
(
0.3
+
rank_distance
);
a0
.
push_back
(
n
);
}
double
rank_angel
=
n
.
angle
+
dir_angle
;
double
rank_distance
=
n
.
distance
/
(
x_right
-
x_left
);
if
(
rank_angel
>
M_PI
)
rank_angel
-=
2
*
M_PI
;
rank_angel
=
fabs
(
rank_angel
)
/
M_PI
;
if
(
rank_angel
>
0.5
)
continue
;
n
.
rank
=
rank_angel
+
(
0.3
+
rank_distance
);
a0
.
push_back
(
n
);
}
}
if
(
a0
.
size
()
==
0
)
return
0
;
// Find best object
double
rank_min
=
1E37
;
FlowArrayElem
*
rank_elem
=
0
;
for
(
int
i
=
0
;
i
<
(
int
)
a0
.
size
();
i
++
)
{
...
...
@@ -1747,6 +1826,73 @@ int FlowCtx::get_next_object( FlowArrayElem *object, flow_eDirection dir,
return
1
;
}
int
FlowCtx
::
is_visible
(
FlowArrayElem
*
element
,
flow_eVisible
type
)
{
double
ll_x
,
ll_y
,
ur_x
,
ur_y
;
double
window_x_low
,
window_x_high
;
double
window_y_low
,
window_y_high
;
if
(
element
->
type
()
!=
flow_eObjectType_Node
)
return
0
;
((
FlowNode
*
)
element
)
->
measure
(
&
ll_x
,
&
ll_y
,
&
ur_x
,
&
ur_y
);
window_x_low
=
double
(
offset_x
)
/
zoom_factor
;
window_x_high
=
double
(
offset_x
+
window_width
)
/
zoom_factor
;
window_y_low
=
double
(
offset_y
)
/
zoom_factor
;
window_y_high
=
double
(
offset_y
+
window_height
)
/
zoom_factor
;
switch
(
type
)
{
case
flow_eVisible_Full
:
if
(
ll_x
>=
window_x_low
&&
ur_x
<=
window_x_high
&&
ll_y
>=
window_y_low
&&
ur_y
<=
window_y_high
)
return
1
;
else
return
0
;
case
flow_eVisible_Partial
:
if
(
((
ll_y
>=
window_y_low
&&
ll_y
<=
window_y_high
)
||
(
ur_y
>=
window_y_low
&&
ur_y
<=
window_y_high
)
||
(
ll_y
<=
window_y_low
&&
ur_y
>=
window_y_high
))
&&
((
ll_x
>=
window_x_low
&&
ll_x
<=
window_x_high
)
||
(
ur_x
>=
window_x_low
&&
ur_x
<=
window_x_high
)
||
(
ll_x
<=
window_x_low
&&
ur_x
>=
window_x_high
)))
return
1
;
else
return
0
;
case
flow_eVisible_Top
:
if
(
ur_y
>=
window_y_low
&&
ur_y
<=
window_y_high
&&
((
ll_x
>=
window_x_low
&&
ll_x
<=
window_x_high
)
||
(
ur_x
>=
window_x_low
&&
ur_x
<=
window_x_high
)
||
(
ll_x
<=
window_x_low
&&
ur_x
>=
window_x_high
)))
return
1
;
else
return
0
;
case
flow_eVisible_Bottom
:
if
(
ll_y
>=
window_y_low
&&
ll_y
<=
window_y_high
&&
((
ll_x
>=
window_x_low
&&
ll_x
<=
window_x_high
)
||
(
ur_x
>=
window_x_low
&&
ur_x
<=
window_x_high
)
||
(
ll_x
<=
window_x_low
&&
ur_x
>=
window_x_high
)))
return
1
;
else
return
0
;
case
flow_eVisible_Right
:
if
(
ur_x
>=
window_x_low
&&
ur_y
<=
window_x_high
&&
((
ll_y
>=
window_y_low
&&
ll_y
<=
window_y_high
)
||
(
ur_y
>=
window_y_low
&&
ur_y
<=
window_y_high
)
||
(
ll_y
<=
window_y_low
&&
ur_y
>=
window_y_high
)))
return
1
;
else
return
0
;
case
flow_eVisible_Left
:
if
(
ll_x
>=
window_x_low
&&
ll_x
<=
window_x_high
&&
((
ll_y
>=
window_y_low
&&
ll_y
<=
window_y_high
)
||
(
ur_y
>=
window_y_low
&&
ur_y
<=
window_y_high
)
||
(
ll_y
<=
window_y_low
&&
ur_y
>=
window_y_high
)))
return
1
;
else
return
0
;
default:
;
}
return
0
;
}
void
FlowCtx
::
change_scrollbar
()
{
...
...
xtt/lib/flow/src/flow_ctx.h
View file @
b32d1950
/*
* Proview $Id: flow_ctx.h,v 1.
6 2007-07-17 12:40:50
claes Exp $
* Proview $Id: flow_ctx.h,v 1.
7 2007-07-18 09:26:43
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -323,8 +323,9 @@ class FlowCtx {
int
find_by_name_no_case
(
char
*
name
,
FlowArrayElem
**
element
)
{
return
a
.
find_by_name_no_case
(
name
,
element
);};
void
get_zoom
(
double
*
zoom
)
{
*
zoom
=
zoom_factor
;};
int
FlowCtx
::
get_next_object
(
FlowArrayElem
*
object
,
flow_eDirection
dir
,
FlowArrayElem
**
next
);
int
get_next_object
(
FlowArrayElem
*
object
,
flow_eDirection
dir
,
FlowArrayElem
**
next
);
int
is_visible
(
FlowArrayElem
*
element
,
flow_eVisible
type
);
~
FlowCtx
();
};
...
...
xtt/lib/ge/src/ge_graph.cpp
View file @
b32d1950
/*
* Proview $Id: ge_graph.cpp,v 1.4
1 2007-07-17 12:40:50
claes Exp $
* Proview $Id: ge_graph.cpp,v 1.4
2 2007-07-18 09:26:43
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -1059,24 +1059,38 @@ void Graph::select_nextobject( glow_eDirection dir)
int
sts
;
sts
=
get_selected_object
(
&
sel
);
if
(
EVEN
(
sts
))
{
message
(
'E'
,
"No object is selected"
)
;
return
;
}
if
(
grow_GetObjectType
(
sel
)
==
glow_eObjectType_Con
)
{
message
(
'E'
,
"Select an object"
)
;
return
;
if
(
EVEN
(
sts
))
sel
=
0
;
else
{
if
(
grow_GetObjectType
(
sel
)
==
glow_eObjectType_Con
)
{
message
(
'E'
,
"Select an object"
);
return
;
}
}
sts
=
grow_GetNextObject
(
grow
->
ctx
,
sel
,
dir
,
&
next
);
if
(
EVEN
(
sts
))
{
message
(
'E'
,
"Unable to find next object"
);
return
;
if
(
!
sel
||
!
grow_IsVisible
(
grow
->
ctx
,
sel
,
glow_eVisible_Partial
))
{
sts
=
grow_GetNextObject
(
grow
->
ctx
,
0
,
dir
,
&
next
);
if
(
EVEN
(
sts
))
{
message
(
'E'
,
"Unable to find visible object"
);
return
;
}
grow_SelectClear
(
grow
->
ctx
);
grow_SetHighlight
(
next
,
1
);
grow_SelectInsert
(
grow
->
ctx
,
next
);
}
else
{
sts
=
grow_GetNextObject
(
grow
->
ctx
,
sel
,
dir
,
&
next
);
if
(
EVEN
(
sts
))
{
message
(
'E'
,
"Unable to find next object"
);
return
;
}
grow_SelectClear
(
grow
->
ctx
);
grow_SetHighlight
(
next
,
1
);
grow_SelectInsert
(
grow
->
ctx
,
next
);
grow_SelectClear
(
grow
->
ctx
);
grow_SetHighlight
(
next
,
1
);
grow_SelectInsert
(
grow
->
ctx
,
next
);
if
(
!
grow_IsVisible
(
grow
->
ctx
,
next
,
glow_eVisible_Partial
))
grow_CenterObject
(
grow
->
ctx
,
next
);
}
}
int
Graph
::
get_selected_object
(
grow_tObject
*
object
)
...
...
xtt/lib/glow/src/glow.h
View file @
b32d1950
/*
* Proview $Id: glow.h,v 1.2
1 2007-07-04 13:28:05
claes Exp $
* Proview $Id: glow.h,v 1.2
2 2007-07-18 09:26:43
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -312,6 +312,15 @@ typedef enum {
glow_eCorner_Right
//!< Right corners
}
glow_eCorner
;
typedef
enum
{
glow_eVisible_Full
,
glow_eVisible_Partial
,
glow_eVisible_Top
,
glow_eVisible_Bottom
,
glow_eVisible_Left
,
glow_eVisible_Right
}
glow_eVisible
;
//! Text Fonts
typedef
enum
{
glow_eFont_Helvetica
,
//!< Font Helvetica
...
...
@@ -322,10 +331,10 @@ typedef enum {
}
glow_eFont
;
typedef
enum
{
glow_eDynamicType_Object
,
glow_eDynamicType_SubGraph
,
glow_eDynamicType_SubGraphEnd
}
glow_eDynamicType
;
glow_eDynamicType_Object
,
glow_eDynamicType_SubGraph
,
glow_eDynamicType_SubGraphEnd
}
glow_eDynamicType
;
//! Type of shadow drawn for an object
typedef
enum
{
...
...
xtt/lib/glow/src/glow_growapi.cpp
View file @
b32d1950
/*
* Proview $Id: glow_growapi.cpp,v 1.3
1 2007-07-17 12:43:54
claes Exp $
* Proview $Id: glow_growapi.cpp,v 1.3
2 2007-07-18 09:26:43
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -4410,6 +4410,11 @@ int grow_GetNextObject( grow_tCtx ctx, grow_tObject object, glow_eDirection dir,
return
ctx
->
get_next_object
(
(
GlowArrayElem
*
)
object
,
dir
,
(
GlowArrayElem
**
)
next
);
}
int
grow_IsVisible
(
grow_tCtx
ctx
,
grow_tObject
object
,
glow_eVisible
type
)
{
return
ctx
->
is_visible
(
(
GlowArrayElem
*
)
object
,
type
);
}
/*@}*/
...
...
xtt/lib/glow/src/glow_growapi.h
View file @
b32d1950
/*
* Proview $Id: glow_growapi.h,v 1.2
6 2007-07-17 12:43:54
claes Exp $
* Proview $Id: glow_growapi.h,v 1.2
7 2007-07-18 09:26:43
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -2846,6 +2846,7 @@ extern "C" {
glow_eScaleType
type
);
int
grow_GetNextObject
(
grow_tCtx
ctx
,
grow_tObject
object
,
glow_eDirection
dir
,
grow_tObject
*
next
);
int
grow_IsVisible
(
grow_tCtx
ctx
,
grow_tObject
object
,
glow_eVisible
type
);
/*@}*/
#if defined __cplusplus
...
...
xtt/lib/glow/src/glow_growctx.cpp
View file @
b32d1950
/*
* Proview $Id: glow_growctx.cpp,v 1.2
5 2007-07-17 12:43:54
claes Exp $
* Proview $Id: glow_growctx.cpp,v 1.2
6 2007-07-18 09:26:43
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -3896,11 +3896,13 @@ void GrowCtx::delete_menu_child( GlowArrayElem *parent)
int
GrowCtx
::
get_next_object
(
GlowArrayElem
*
object
,
glow_eDirection
dir
,
GlowArrayElem
**
next
)
{
if
(
!
(
object
->
type
()
==
glow_eObjectType_GrowNode
||
if
(
object
&&
!
(
object
->
type
()
==
glow_eObjectType_GrowNode
||
object
->
type
()
==
glow_eObjectType_GrowSlider
||
object
->
type
()
==
glow_eObjectType_GrowGroup
||
object
->
type
()
==
glow_eObjectType_GrowTrend
||
object
->
type
()
==
glow_eObjectType_GrowBar
))
{
object
->
type
()
==
glow_eObjectType_GrowBar
||
object
->
type
()
==
glow_eObjectType_GrowText
))
{
return
0
;
}
...
...
@@ -3908,73 +3910,158 @@ int GrowCtx::get_next_object( GlowArrayElem *object, glow_eDirection dir,
double
a_ll_x
,
a_ll_y
,
a_ur_x
,
a_ur_y
;
double
x
,
y
,
a_x
,
a_y
;
double
dir_angle
;
vector
<
NextElem
>
a0
;
object
->
measure
(
&
ll_x
,
&
ll_y
,
&
ur_x
,
&
ur_y
);
x
=
(
ll_x
+
ur_x
)
/
2
;
y
=
(
ll_y
+
ur_y
)
/
2
;
switch
(
dir
)
{
case
glow_eDirection_Left
:
dir_angle
=
M_PI
;
break
;
case
glow_eDirection_Right
:
dir_angle
=
0
;
break
;
case
glow_eDirection_Up
:
dir_angle
=
-
M_PI
/
2
;
break
;
case
glow_eDirection_Down
:
dir_angle
=
M_PI
/
2
;
break
;
default:
;
if
(
!
object
)
{
// Chose a visible object
double
window_x_low
,
window_x_high
;
double
window_y_low
,
window_y_high
;
window_x_low
=
double
(
mw
.
offset_x
)
/
mw
.
zoom_factor_x
;
window_x_high
=
double
(
mw
.
offset_x
+
mw
.
window_width
)
/
mw
.
zoom_factor_x
;
window_y_low
=
double
(
mw
.
offset_y
)
/
mw
.
zoom_factor_y
;
window_y_high
=
double
(
mw
.
offset_y
+
mw
.
window_height
)
/
mw
.
zoom_factor_y
;
for
(
int
i
=
0
;
i
<
a
.
size
();
i
++
)
{
if
(
a
[
i
]
->
type
()
==
glow_eObjectType_GrowNode
||
a
[
i
]
->
type
()
==
glow_eObjectType_GrowSlider
||
a
[
i
]
->
type
()
==
glow_eObjectType_GrowGroup
||
a
[
i
]
->
type
()
==
glow_eObjectType_GrowTrend
||
a
[
i
]
->
type
()
==
glow_eObjectType_GrowBar
||
a
[
i
]
->
type
()
==
glow_eObjectType_GrowText
)
{
NextElem
n
;
a
[
i
]
->
measure
(
&
a_ll_x
,
&
a_ll_y
,
&
a_ur_x
,
&
a_ur_y
);
if
(
a_ll_x
>=
window_x_low
&&
a_ur_x
<=
window_x_high
&&
a_ll_y
>=
window_y_low
&&
a_ur_y
<=
window_y_high
)
{
// Fully visible
switch
(
dir
)
{
case
glow_eDirection_Left
:
n
.
rank
=
(
window_x_high
-
a_ur_x
)
/
(
window_x_high
-
window_x_low
);
break
;
case
glow_eDirection_Right
:
n
.
rank
=
(
a_ll_x
-
window_x_low
)
/
(
window_x_high
-
window_x_low
);
break
;
case
glow_eDirection_Up
:
n
.
rank
=
(
window_y_high
-
a_ur_y
)
/
(
window_y_high
-
window_y_low
);
break
;
case
glow_eDirection_Down
:
n
.
rank
=
(
a_ll_y
-
window_y_low
)
/
(
window_y_high
-
window_y_low
);
break
;
default:
;
}
n
.
elem
=
a
[
i
];
a0
.
push_back
(
n
);
}
else
if
(
((
a_ll_y
>=
window_y_low
&&
a_ll_y
<=
window_y_high
)
||
(
a_ur_y
>=
window_y_low
&&
a_ur_y
<=
window_y_high
)
||
(
a_ll_y
<=
window_y_low
&&
a_ur_y
>=
window_y_high
))
&&
((
a_ll_x
>=
window_x_low
&&
a_ll_x
<=
window_x_high
)
||
(
a_ur_x
>=
window_x_low
&&
a_ur_x
<=
window_x_high
)
||
(
a_ll_x
<=
window_x_low
&&
a_ur_x
>=
window_x_high
)))
{
// Partially visible
switch
(
dir
)
{
case
glow_eDirection_Left
:
n
.
rank
=
(
window_x_high
-
a_ur_x
)
/
(
window_x_high
-
window_x_low
)
+
10
;
break
;
case
glow_eDirection_Right
:
n
.
rank
=
(
a_ll_x
-
window_x_low
)
/
(
window_x_high
-
window_x_low
)
+
10
;
break
;
case
glow_eDirection_Up
:
n
.
rank
=
(
window_y_high
-
a_ur_y
)
/
(
window_y_high
-
window_y_low
)
+
10
;
break
;
case
glow_eDirection_Down
:
n
.
rank
=
(
a_ll_y
-
window_y_low
)
/
(
window_y_high
-
window_y_low
)
+
10
;
break
;
default:
;
}
n
.
elem
=
a
[
i
];
a0
.
push_back
(
n
);
}
}
}
if
(
a0
.
size
()
==
0
)
return
0
;
}
else
{
vector
<
NextElem
>
a0
;
for
(
int
i
=
0
;
i
<
a
.
size
();
i
++
)
{
if
(
a
[
i
]
==
object
)
continue
;
if
(
a
[
i
]
->
type
()
==
glow_eObjectType_GrowNode
||
a
[
i
]
->
type
()
==
glow_eObjectType_GrowSlider
||
a
[
i
]
->
type
()
==
glow_eObjectType_GrowGroup
||
a
[
i
]
->
type
()
==
glow_eObjectType_GrowTrend
||
a
[
i
]
->
type
()
==
glow_eObjectType_GrowBar
)
{
a
[
i
]
->
measure
(
&
a_ll_x
,
&
a_ll_y
,
&
a_ur_x
,
&
a_ur_y
);
if
(
ll_x
>=
a_ll_x
&&
ur_x
<=
a_ur_x
&&
ll_y
>=
a_ll_y
&&
ur_y
<=
a_ur_y
)
object
->
measure
(
&
ll_x
,
&
ll_y
,
&
ur_x
,
&
ur_y
);
x
=
(
ll_x
+
ur_x
)
/
2
;
y
=
(
ll_y
+
ur_y
)
/
2
;
switch
(
dir
)
{
case
glow_eDirection_Left
:
dir_angle
=
M_PI
;
break
;
case
glow_eDirection_Right
:
dir_angle
=
0
;
break
;
case
glow_eDirection_Up
:
dir_angle
=
-
M_PI
/
2
;
break
;
case
glow_eDirection_Down
:
dir_angle
=
M_PI
/
2
;
break
;
default:
;
}
for
(
int
i
=
0
;
i
<
a
.
size
();
i
++
)
{
if
(
a
[
i
]
==
object
)
continue
;
a_x
=
(
a_ll_x
+
a_ur_x
)
/
2
;
a_y
=
(
a_ll_y
+
a_ur_y
)
/
2
;
if
(
a
[
i
]
->
type
()
==
glow_eObjectType_GrowNode
||
a
[
i
]
->
type
()
==
glow_eObjectType_GrowSlider
||
a
[
i
]
->
type
()
==
glow_eObjectType_GrowGroup
||
a
[
i
]
->
type
()
==
glow_eObjectType_GrowTrend
||
a
[
i
]
->
type
()
==
glow_eObjectType_GrowBar
||
a
[
i
]
->
type
()
==
glow_eObjectType_GrowText
)
{
a
[
i
]
->
measure
(
&
a_ll_x
,
&
a_ll_y
,
&
a_ur_x
,
&
a_ur_y
);
if
(
ll_x
>=
a_ll_x
&&
ur_x
<=
a_ur_x
&&
ll_y
>=
a_ll_y
&&
ur_y
<=
a_ur_y
)
continue
;
a_x
=
(
a_ll_x
+
a_ur_x
)
/
2
;
a_y
=
(
a_ll_y
+
a_ur_y
)
/
2
;
NextElem
n
;
n
.
elem
=
a
[
i
];
n
.
distance
=
sqrt
((
a_x
-
x
)
*
(
a_x
-
x
)
+
(
a_y
-
y
)
*
(
a_y
-
y
));
if
(
fabs
(
a_y
-
y
)
<
DBL_EPSILON
)
{
if
(
a_x
>
x
)
n
.
angle
=
0
;
else
n
.
angle
=
M_PI
;
}
else
{
n
.
angle
=
atan
((
a_x
-
x
)
/
(
a_y
-
y
))
+
M_PI
/
2
;
if
(
(
a_y
-
y
)
>
0
)
n
.
angle
-=
M_PI
;
NextElem
n
;
n
.
elem
=
a
[
i
];
n
.
distance
=
sqrt
((
a_x
-
x
)
*
(
a_x
-
x
)
+
(
a_y
-
y
)
*
(
a_y
-
y
));
if
(
fabs
(
a_y
-
y
)
<
DBL_EPSILON
)
{
if
(
a_x
>
x
)
n
.
angle
=
0
;
else
n
.
angle
=
M_PI
;
}
else
{
n
.
angle
=
atan
((
a_x
-
x
)
/
(
a_y
-
y
))
+
M_PI
/
2
;
if
(
(
a_y
-
y
)
>
0
)
n
.
angle
-=
M_PI
;
}
double
rank_angel
=
n
.
angle
+
dir_angle
;
double
rank_distance
=
n
.
distance
/
(
x_right
-
x_left
);
if
(
rank_angel
>
M_PI
)
rank_angel
-=
2
*
M_PI
;
rank_angel
=
fabs
(
rank_angel
)
/
M_PI
;
if
(
rank_angel
>
0.5
)
continue
;
n
.
rank
=
rank_angel
+
(
0.3
+
rank_distance
);
a0
.
push_back
(
n
);
}
double
rank_angel
=
n
.
angle
+
dir_angle
;
double
rank_distance
=
n
.
distance
/
(
x_right
-
x_left
);
if
(
rank_angel
>
M_PI
)
rank_angel
-=
2
*
M_PI
;
rank_angel
=
fabs
(
rank_angel
)
/
M_PI
;
if
(
rank_angel
>
0.5
)
continue
;
n
.
rank
=
rank_angel
+
(
0.3
+
rank_distance
);
a0
.
push_back
(
n
);
}
if
(
a0
.
size
()
==
0
)
return
0
;
}
if
(
a0
.
size
()
==
0
)
return
0
;
double
rank_min
=
1E37
;
GlowArrayElem
*
rank_elem
=
0
;
...
...
@@ -3990,3 +4077,68 @@ int GrowCtx::get_next_object( GlowArrayElem *object, glow_eDirection dir,
*
next
=
rank_elem
;
return
1
;
}
int
GrowCtx
::
is_visible
(
GlowArrayElem
*
element
,
glow_eVisible
type
)
{
double
ll_x
,
ll_y
,
ur_x
,
ur_y
;
double
window_x_low
,
window_x_high
;
double
window_y_low
,
window_y_high
;
element
->
measure
(
&
ll_x
,
&
ll_y
,
&
ur_x
,
&
ur_y
);
window_x_low
=
double
(
mw
.
offset_x
)
/
mw
.
zoom_factor_x
;
window_x_high
=
double
(
mw
.
offset_x
+
mw
.
window_width
)
/
mw
.
zoom_factor_x
;
window_y_low
=
double
(
mw
.
offset_y
)
/
mw
.
zoom_factor_y
;
window_y_high
=
double
(
mw
.
offset_y
+
mw
.
window_height
)
/
mw
.
zoom_factor_y
;
switch
(
type
)
{
case
glow_eVisible_Full
:
if
(
ll_x
>=
window_x_low
&&
ur_x
<=
window_x_high
&&
ll_y
>=
window_y_low
&&
ur_y
<=
window_y_high
)
return
1
;
else
return
0
;
case
glow_eVisible_Partial
:
if
(
((
ll_y
>=
window_y_low
&&
ll_y
<=
window_y_high
)
||
(
ur_y
>=
window_y_low
&&
ur_y
<=
window_y_high
)
||
(
ll_y
<=
window_y_low
&&
ur_y
>=
window_y_high
))
&&
((
ll_x
>=
window_x_low
&&
ll_x
<=
window_x_high
)
||
(
ur_x
>=
window_x_low
&&
ur_x
<=
window_x_high
)
||
(
ll_x
<=
window_x_low
&&
ur_x
>=
window_x_high
)))
return
1
;
else
return
0
;
case
glow_eVisible_Top
:
if
(
ur_y
>=
window_y_low
&&
ur_y
<=
window_y_high
&&
((
ll_x
>=
window_x_low
&&
ll_x
<=
window_x_high
)
||
(
ur_x
>=
window_x_low
&&
ur_x
<=
window_x_high
)
||
(
ll_x
<=
window_x_low
&&
ur_x
>=
window_x_high
)))
return
1
;
else
return
0
;
case
glow_eVisible_Bottom
:
if
(
ll_y
>=
window_y_low
&&
ll_y
<=
window_y_high
&&
((
ll_x
>=
window_x_low
&&
ll_x
<=
window_x_high
)
||
(
ur_x
>=
window_x_low
&&
ur_x
<=
window_x_high
)
||
(
ll_x
<=
window_x_low
&&
ur_x
>=
window_x_high
)))
return
1
;
else
return
0
;
case
glow_eVisible_Right
:
if
(
ur_x
>=
window_x_low
&&
ur_y
<=
window_x_high
&&
((
ll_y
>=
window_y_low
&&
ll_y
<=
window_y_high
)
||
(
ur_y
>=
window_y_low
&&
ur_y
<=
window_y_high
)
||
(
ll_y
<=
window_y_low
&&
ur_y
>=
window_y_high
)))
return
1
;
else
return
0
;
case
glow_eVisible_Left
:
if
(
ll_x
>=
window_x_low
&&
ll_x
<=
window_x_high
&&
((
ll_y
>=
window_y_low
&&
ll_y
<=
window_y_high
)
||
(
ur_y
>=
window_y_low
&&
ur_y
<=
window_y_high
)
||
(
ll_y
<=
window_y_low
&&
ur_y
>=
window_y_high
)))
return
1
;
else
return
0
;
default:
;
}
return
0
;
}
xtt/lib/glow/src/glow_growctx.h
View file @
b32d1950
/*
* Proview $Id: glow_growctx.h,v 1.1
2 2007-07-17 12:43:54
claes Exp $
* Proview $Id: glow_growctx.h,v 1.1
3 2007-07-18 09:26:43
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -780,6 +780,9 @@ class GrowCtx : public GlowCtx {
int
get_next_object
(
GlowArrayElem
*
object
,
glow_eDirection
dir
,
GlowArrayElem
**
next
);
//! Check if object is visible. */
int
GrowCtx
::
is_visible
(
GlowArrayElem
*
element
,
glow_eVisible
type
);
char
name
[
40
];
//!< Name of the context.
grow_eMode
edit_mode
;
//!< Current edit mode.
int
conpoint_num_cnt
;
//!< Counter to get next number for when creating conpoints in a subgraph.
...
...
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