Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
185e430e
Commit
185e430e
authored
17 years ago
by
Christophe Geuzaine
Browse files
Options
Downloads
Patches
Plain Diff
cleanup
parent
24046272
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Fltk/GUI_Projection.cpp
+84
-81
84 additions, 81 deletions
Fltk/GUI_Projection.cpp
Fltk/GUI_Projection.h
+14
-7
14 additions, 7 deletions
Fltk/GUI_Projection.h
with
98 additions
and
88 deletions
Fltk/GUI_Projection.cpp
+
84
−
81
View file @
185e430e
...
...
@@ -28,8 +28,47 @@ void uvPlot::draw()
fl_draw
(
"Hello"
,
w
()
/
2
,
h
()
/
2
);
}
projection
::
projection
(
FProjectionFace
*
f
,
int
x
,
int
y
,
int
w
,
int
h
,
int
BB
,
int
BH
,
projectionEditor
*
e
)
:
face
(
f
)
{
group
=
new
Fl_Scroll
(
x
,
y
,
w
,
h
);
SBoundingBox3d
bounds
=
GMODEL
->
bounds
();
ProjectionSurface
*
ps
=
f
->
GetProjectionSurface
();
for
(
int
i
=
0
;
i
<
ps
->
GetNumParameters
()
+
9
;
i
++
){
Fl_Value_Input
*
v
=
new
Fl_Value_Input
(
x
,
y
+
i
*
BH
,
BB
,
BH
);
if
(
i
<
3
){
// scaling
v
->
maximum
(
CTX
.
lc
*
10.
);
v
->
minimum
(
CTX
.
lc
/
100.
);
v
->
step
(
CTX
.
lc
/
100.
);
v
->
label
((
i
==
0
)
?
"X scale"
:
(
i
==
1
)
?
"Y scale"
:
"Z scale"
);
v
->
value
(
1.
);
}
else
if
(
i
<
6
){
//rotation
v
->
maximum
(
-
180.
);
v
->
minimum
(
180.
);
v
->
step
(
0.1
);
v
->
label
((
i
==
3
)
?
"X rotation"
:
(
i
==
4
)
?
"Y rotation"
:
"Z rotation"
);
}
else
if
(
i
<
9
){
// translation
v
->
maximum
(
bounds
.
max
()[
i
]
+
CTX
.
lc
);
v
->
minimum
(
bounds
.
min
()[
i
]
-
CTX
.
lc
);
v
->
step
(
CTX
.
lc
/
100.
);
v
->
label
((
i
==
6
)
?
"X translation"
:
(
i
==
7
)
?
"Y translation"
:
"Z translation"
);
}
else
{
// other parameters
v
->
label
(
"My nice label"
);
v
->
value
(
ps
->
GetParameter
(
i
-
9
));
}
v
->
align
(
FL_ALIGN_RIGHT
);
v
->
callback
(
update_cb
,
e
);
parameters
.
push_back
(
v
);
}
group
->
end
();
group
->
hide
();
}
projectionEditor
::
projectionEditor
(
std
::
vector
<
FProjectionFace
*>
&
faces
)
:
_faces
(
faces
)
{
// construct GUI in terms of standard sizes
const
int
BH
=
2
*
GetFontSize
()
+
1
,
BB
=
7
*
GetFontSize
(),
WB
=
7
;
...
...
@@ -51,39 +90,34 @@ projectionEditor::projectionEditor(std::vector<FProjectionFace*> &faces)
}
o
->
end
();
Fl_Toggle_Button
*
b1
=
new
Fl_Toggle_Button
(
width
-
WB
-
(
int
)(
1.5
*
BB
),
WB
,
(
int
)(
1.5
*
BB
),
BH
,
"Hide unselected"
);
Fl_Toggle_Button
*
b1
=
new
Fl_Toggle_Button
(
width
-
WB
-
(
int
)(
1.5
*
BB
),
WB
,
(
int
)(
1.5
*
BB
),
BH
,
"Hide unselected"
);
b1
->
callback
(
hide_cb
);
Fl_Button
*
b2
=
new
Fl_Button
(
width
-
WB
-
(
int
)(
1.5
*
BB
),
WB
+
BH
,
(
int
)(
1.5
*
BB
),
BH
,
"Save selection"
);
Fl_Button
*
b2
=
new
Fl_Button
(
width
-
WB
-
(
int
)(
1.5
*
BB
),
WB
+
BH
,
(
int
)(
1.5
*
BB
),
BH
,
"Save selection"
);
b2
->
callback
(
save_cb
,
this
);
_browser
=
new
Fl_Hold_Browser
(
WB
,
2
*
WB
+
3
*
BH
,
BB
,
5
*
BH
);
const
int
brw
=
(
int
)(
1.25
*
BB
);
_browser
=
new
Fl_Hold_Browser
(
WB
,
2
*
WB
+
3
*
BH
,
brw
,
5
*
BH
);
_browser
->
callback
(
browse_cb
,
this
);
for
(
unsigned
int
i
=
0
;
i
<
_
faces
.
size
();
i
++
){
ProjectionSurface
*
ps
=
_
faces
[
i
]
->
GetProjectionSurface
();
for
(
unsigned
int
i
=
0
;
i
<
faces
.
size
();
i
++
){
ProjectionSurface
*
ps
=
faces
[
i
]
->
GetProjectionSurface
();
_browser
->
add
(
ps
->
GetName
().
c_str
());
_projections
.
push_back
(
new
projection
(
faces
[
i
],
2
*
WB
+
brw
,
2
*
WB
+
3
*
BH
,
width
-
3
*
WB
-
brw
,
5
*
BH
,
BB
,
BH
,
this
));
}
Fl_Scroll
*
s
=
new
Fl_Scroll
(
2
*
WB
+
BB
,
2
*
WB
+
3
*
BH
,
width
-
3
*
WB
-
BB
,
5
*
BH
);
for
(
int
i
=
0
;
i
<
MAX_PROJECTION_PARAMETERS
;
i
++
){
_input
[
i
]
=
new
Fl_Value_Input
(
2
*
WB
+
BB
,
2
*
WB
+
(
i
+
3
)
*
BH
,
BB
,
BH
);
_input
[
i
]
->
align
(
FL_ALIGN_RIGHT
);
_input
[
i
]
->
callback
(
update_cb
,
this
);
_input
[
i
]
->
hide
();
}
s
->
end
();
_uvPlot
=
new
uvPlot
(
WB
,
3
*
WB
+
8
*
BH
,
width
-
2
*
WB
,
height
-
5
*
WB
-
9
*
BH
);
_uvPlot
->
end
();
Fl_Button
*
b3
=
new
Fl_Button
(
width
-
2
*
WB
-
2
*
BB
,
height
-
WB
-
BH
,
BB
,
BH
,
"Compute"
);
Fl_Button
*
b3
=
new
Fl_Button
(
width
-
2
*
WB
-
2
*
BB
,
height
-
WB
-
BH
,
BB
,
BH
,
"Compute"
);
b3
->
callback
(
compute_cb
,
this
);
Fl_Button
*
b4
=
new
Fl_Button
(
width
-
WB
-
BB
,
height
-
WB
-
BH
,
BB
,
BH
,
"Cancel"
);
Fl_Button
*
b4
=
new
Fl_Button
(
width
-
WB
-
BB
,
height
-
WB
-
BH
,
BB
,
BH
,
"Cancel"
);
b4
->
callback
(
close_cb
,
_window
);
_window
->
end
();
...
...
@@ -101,60 +135,27 @@ int projectionEditor::getSelectionMode()
return
ENT_ALL
;
}
FP
rojection
Face
*
projectionEditor
::
getCurrentProjection
Face
()
p
rojection
*
projectionEditor
::
getCurrentProjection
()
{
for
(
int
i
=
1
;
i
<=
_browser
->
size
();
i
++
)
if
(
_browser
->
selected
(
i
))
return
_
face
s
[
i
-
1
];
if
(
_browser
->
selected
(
i
))
return
_
projection
s
[
i
-
1
];
return
0
;
}
Fl_Value_Input
*
projectionEditor
::
getValueInput
(
int
i
)
{
if
(
i
<
0
||
i
>
MAX_PROJECTION_PARAMETERS
-
1
)
return
0
;
return
_input
[
i
];
}
void
browse_cb
(
Fl_Widget
*
w
,
void
*
data
)
{
projectionEditor
*
e
=
(
projectionEditor
*
)
data
;
SBoundingBox3d
bounds
=
GMODEL
->
bounds
();
std
::
vector
<
FProjectionFace
*>
&
faces
(
e
->
getProjectionFaces
());
for
(
unsigned
int
i
=
0
;
i
<
faces
.
size
();
i
++
)
faces
[
i
]
->
setVisibility
(
false
);
std
::
vector
<
projection
*>
&
projections
(
e
->
getProjections
());
for
(
unsigned
int
i
=
0
;
i
<
projections
.
size
();
i
++
){
projections
[
i
]
->
face
->
setVisibility
(
false
);
projections
[
i
]
->
group
->
hide
();
}
for
(
int
i
=
0
;
i
<
MAX_PROJECTION_PARAMETERS
;
i
++
)
e
->
getValueInput
(
i
)
->
hide
();
FProjectionFace
*
f
=
e
->
getCurrentProjectionFace
();
if
(
f
){
f
->
setVisibility
(
true
);
ProjectionSurface
*
ps
=
f
->
GetProjectionSurface
();
for
(
int
i
=
0
;
i
<
9
;
i
++
){
e
->
getValueInput
(
i
)
->
show
();
if
(
i
<
3
){
// scaling
e
->
getValueInput
(
i
)
->
maximum
(
CTX
.
lc
*
10.
);
e
->
getValueInput
(
i
)
->
minimum
(
CTX
.
lc
/
100.
);
e
->
getValueInput
(
i
)
->
step
(
CTX
.
lc
/
100.
);
e
->
getValueInput
(
i
)
->
label
((
i
==
0
)
?
"X scale"
:
(
i
==
1
)
?
"Y scale"
:
"Z scale"
);
e
->
getValueInput
(
i
)
->
value
(
1.
);
// FIXME
}
else
if
(
i
<
6
){
//rotation
e
->
getValueInput
(
i
)
->
maximum
(
-
180.
);
e
->
getValueInput
(
i
)
->
minimum
(
180.
);
e
->
getValueInput
(
i
)
->
step
(
0.1
);
}
else
{
// translation
e
->
getValueInput
(
i
)
->
maximum
(
bounds
.
max
()[
i
]
+
CTX
.
lc
);
e
->
getValueInput
(
i
)
->
minimum
(
bounds
.
min
()[
i
]
-
CTX
.
lc
);
e
->
getValueInput
(
i
)
->
step
(
CTX
.
lc
/
100.
);
}
}
for
(
int
i
=
9
;
i
<
9
+
ps
->
GetNumParameters
();
i
++
){
e
->
getValueInput
(
i
)
->
show
();
e
->
getValueInput
(
i
)
->
label
(
"My nice label"
);
e
->
getValueInput
(
i
)
->
value
(
ps
->
GetParameter
(
i
-
9
));
}
projection
*
p
=
e
->
getCurrentProjection
();
if
(
p
){
p
->
face
->
setVisibility
(
true
);
p
->
group
->
show
();
}
Draw
();
}
...
...
@@ -164,20 +165,20 @@ void update_cb(Fl_Widget *w, void *data)
projectionEditor
*
e
=
(
projectionEditor
*
)
data
;
// get all parameters from GUI and modify projection surface accordingly
FP
rojection
Face
*
f
=
e
->
getCurrentProjection
Face
();
if
(
f
){
ProjectionSurface
*
ps
=
f
->
GetProjectionSurface
();
ps
->
Rescale
(
e
->
getValueInput
(
0
)
->
value
(),
e
->
getValueInput
(
1
)
->
value
(),
e
->
getValueInput
(
2
)
->
value
());
ps
->
Rotate
(
e
->
getValueInput
(
3
)
->
value
(),
e
->
getValueInput
(
4
)
->
value
(),
e
->
getValueInput
(
5
)
->
value
());
ps
->
Translate
(
e
->
getValueInput
(
6
)
->
value
(),
e
->
getValueInput
(
7
)
->
value
(),
e
->
getValueInput
(
8
)
->
value
());
p
rojection
*
p
=
e
->
getCurrentProjection
();
if
(
p
){
ProjectionSurface
*
ps
=
p
->
face
->
GetProjectionSurface
();
ps
->
Rescale
(
p
->
parameters
[
0
]
->
value
(),
p
->
parameters
[
1
]
->
value
(),
p
->
parameters
[
2
]
->
value
());
ps
->
Rotate
(
p
->
parameters
[
3
]
->
value
(),
p
->
parameters
[
4
]
->
value
(),
p
->
parameters
[
5
]
->
value
());
ps
->
Translate
(
p
->
parameters
[
6
]
->
value
(),
p
->
parameters
[
7
]
->
value
(),
p
->
parameters
[
8
]
->
value
());
for
(
int
i
=
9
;
i
<
9
+
ps
->
GetNumParameters
();
i
++
)
ps
->
SetParameter
(
i
-
9
,
e
->
getValueInput
(
i
)
->
value
());
ps
->
SetParameter
(
i
-
9
,
p
->
parameters
[
i
]
->
value
());
Draw
();
}
...
...
@@ -331,8 +332,10 @@ void mesh_parameterize_cb(Fl_Widget* w, void* data)
// create one instance of each available projection surface
std
::
vector
<
FProjectionFace
*>
faces
;
if
(
faces
.
empty
()){
faces
.
push_back
(
new
FProjectionFace
(
GMODEL
,
10000
,
new
CylindricalProjectionSurface
(
0
)));
faces
.
push_back
(
new
FProjectionFace
(
GMODEL
,
10001
,
new
RevolvedParabolaProjectionSurface
(
0
)));
faces
.
push_back
(
new
FProjectionFace
(
GMODEL
,
10000
,
new
CylindricalProjectionSurface
(
0
)));
faces
.
push_back
(
new
FProjectionFace
(
GMODEL
,
10001
,
new
RevolvedParabolaProjectionSurface
(
0
)));
}
// make each projection surface invisible and
...
...
This diff is collapsed.
Click to expand it.
Fltk/GUI_Projection.h
+
14
−
7
View file @
185e430e
...
...
@@ -14,8 +14,6 @@
#include
<vector>
#include
"FProjectionFace.h"
#define MAX_PROJECTION_PARAMETERS 20
void
select_cb
(
Fl_Widget
*
w
,
void
*
data
);
void
browse_cb
(
Fl_Widget
*
w
,
void
*
data
);
void
update_cb
(
Fl_Widget
*
w
,
void
*
data
);
...
...
@@ -33,13 +31,23 @@ class uvPlot : public Fl_Window {
void
fill
(
std
::
vector
<
double
>
&
u
,
std
::
vector
<
double
>
&
v
){
_u
=
u
;
_v
=
v
;
redraw
();
}
};
class
projectionEditor
;
class
projection
{
public:
FProjectionFace
*
face
;
Fl_Group
*
group
;
std
::
vector
<
Fl_Value_Input
*>
parameters
;
projection
(
FProjectionFace
*
f
,
int
x
,
int
y
,
int
w
,
int
h
,
int
BB
,
int
BH
,
projectionEditor
*
e
);
};
class
projectionEditor
{
private:
std
::
vector
<
FP
rojection
Face
*>
_face
s
;
std
::
vector
<
p
rojection
*>
_projection
s
;
std
::
vector
<
MElement
*>
_elements
;
std
::
vector
<
GEntity
*>
_entities
;
Fl_Window
*
_window
;
Fl_Value_Input
*
_input
[
MAX_PROJECTION_PARAMETERS
];
Fl_Hold_Browser
*
_browser
;
Fl_Round_Button
*
_select
[
3
];
uvPlot
*
_uvPlot
;
...
...
@@ -49,10 +57,9 @@ class projectionEditor {
uvPlot
*
uv
()
{
return
_uvPlot
;
}
std
::
vector
<
MElement
*>
&
getElements
()
{
return
_elements
;
}
std
::
vector
<
GEntity
*>
&
getEntities
()
{
return
_entities
;
}
std
::
vector
<
FP
rojection
Face
*>
&
getProjection
Face
s
()
{
return
_
face
s
;
}
FP
rojection
Face
*
getCurrentProjection
Face
();
std
::
vector
<
p
rojection
*>
&
getProjections
()
{
return
_
projection
s
;
}
p
rojection
*
getCurrentProjection
();
int
getSelectionMode
();
Fl_Value_Input
*
getValueInput
(
int
i
);
};
#endif
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment