Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
David Cazier
CGoGN
Commits
222b9959
Commit
222b9959
authored
Jan 23, 2013
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SCHNApps: new addMap method
parent
4b478c61
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
30 deletions
+27
-30
SCHNApps/Plugins/importSurface/importSurface.cpp
SCHNApps/Plugins/importSurface/importSurface.cpp
+18
-17
SCHNApps/include/window.h
SCHNApps/include/window.h
+1
-2
SCHNApps/src/window.cpp
SCHNApps/src/window.cpp
+8
-11
No files found.
SCHNApps/Plugins/importSurface/importSurface.cpp
View file @
222b9959
...
...
@@ -20,28 +20,29 @@ void ImportSurfacePlugin::importFromFile(const QString& fileName)
QFileInfo
fi
(
fileName
);
if
(
fi
.
exists
())
{
GenericMap
*
m
=
m_window
->
createMap
(
2
);
PFP2
::
MAP
*
map
=
static_cast
<
PFP2
::
MAP
*>
(
m
);
MapHandler
<
PFP2
>*
h
=
new
MapHandler
<
PFP2
>
(
fi
.
baseName
(),
m_window
,
map
);
MapHandlerGen
*
mhg
=
m_window
->
addMap
(
fi
.
baseName
(),
2
);
if
(
mhg
)
{
MapHandler
<
PFP2
>*
mh
=
static_cast
<
MapHandler
<
PFP2
>*>
(
mhg
);
PFP2
::
MAP
*
map
=
mh
->
getMap
();
std
::
vector
<
std
::
string
>
attrNames
;
Algo
::
Surface
::
Import
::
importMesh
<
PFP2
>
(
*
map
,
fileName
.
toUtf8
().
constData
(),
attrNames
);
std
::
vector
<
std
::
string
>
attrNames
;
Algo
::
Surface
::
Import
::
importMesh
<
PFP2
>
(
*
map
,
fileName
.
toUtf8
().
constData
(),
attrNames
);
// get vertex position attribute
VertexAttribute
<
PFP2
::
VEC3
>
position
=
map
->
getAttribute
<
PFP2
::
VEC3
,
CGoGN
::
VERTEX
>
(
attrNames
[
0
]);
// get vertex position attribute
VertexAttribute
<
PFP2
::
VEC3
>
position
=
map
->
getAttribute
<
PFP2
::
VEC3
,
CGoGN
::
VERTEX
>
(
attrNames
[
0
]);
// create VBO for vertex position attribute
h
->
createVBO
(
position
);
// create VBO for vertex position attribute
m
h
->
createVBO
(
position
);
// compute map bounding box
h
->
updateBB
(
position
);
// compute map bounding box
m
h
->
updateBB
(
position
);
// compute primitive connectivity VBOs
h
->
updatePrimitives
(
Algo
::
Render
::
GL2
::
POINTS
);
h
->
updatePrimitives
(
Algo
::
Render
::
GL2
::
LINES
);
h
->
updatePrimitives
(
Algo
::
Render
::
GL2
::
TRIANGLES
);
m_window
->
addMap
(
h
);
// compute primitive connectivity VBOs
mh
->
updatePrimitives
(
Algo
::
Render
::
GL2
::
POINTS
);
mh
->
updatePrimitives
(
Algo
::
Render
::
GL2
::
LINES
);
mh
->
updatePrimitives
(
Algo
::
Render
::
GL2
::
TRIANGLES
);
}
}
}
...
...
SCHNApps/include/window.h
View file @
222b9959
...
...
@@ -213,8 +213,7 @@ public:
* MANAGE MAPS
*********************************************************/
GenericMap
*
createMap
(
unsigned
int
dim
);
bool
addMap
(
MapHandlerGen
*
map
);
MapHandlerGen
*
addMap
(
const
QString
&
name
,
unsigned
int
dim
);
void
removeMap
(
const
QString
&
name
);
MapHandlerGen
*
getMap
(
const
QString
&
name
)
const
;
QList
<
MapHandlerGen
*>
getMapsList
()
const
{
return
h_maps
.
values
();
}
...
...
SCHNApps/src/window.cpp
View file @
222b9959
...
...
@@ -514,8 +514,11 @@ Plugin* Window::checkPluginDependencie(QString name, Plugin* dependantPlugin)
* MANAGE MAPS
*********************************************************/
GenericMap
*
Window
::
createMap
(
unsigned
int
dim
)
MapHandlerGen
*
Window
::
addMap
(
const
QString
&
name
,
unsigned
int
dim
)
{
if
(
h_maps
.
contains
(
name
))
return
NULL
;
GenericMap
*
map
=
NULL
;
switch
(
dim
)
{
...
...
@@ -526,19 +529,13 @@ GenericMap* Window::createMap(unsigned int dim)
map
=
new
PFP3
::
MAP
();
break
;
}
return
map
;
}
bool
Window
::
addMap
(
MapHandlerGen
*
map
)
{
if
(
h_maps
.
contains
(
map
->
getName
()))
return
false
;
MapHandlerGen
*
mh
=
new
MapHandlerGen
(
name
,
this
,
map
);
h_maps
.
insert
(
name
,
mh
);
h_maps
.
insert
(
map
->
getName
(),
map
);
emit
(
mapAdded
(
mh
)
);
emit
(
mapAdded
(
map
));
return
true
;
return
mh
;
}
void
Window
::
removeMap
(
const
QString
&
name
)
...
...
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