+ implement global draw styles
+ use double precision in XML file + fix crash with in SoBrepFaceSet git-svn-id: https://free-cad.svn.sourceforge.net/svnroot/free-cad/trunk@5083 e8eeb9e2-ec13-0410-a4a9-efa5cf37419d
This commit is contained in:
parent
b2748ea427
commit
a65d4fdda6
|
@ -177,6 +177,8 @@ ZipWriter::ZipWriter(const char* FileName)
|
||||||
//FIXME: Check whether this is correct
|
//FIXME: Check whether this is correct
|
||||||
ZipStream.imbue(std::locale::classic());
|
ZipStream.imbue(std::locale::classic());
|
||||||
#endif
|
#endif
|
||||||
|
ZipStream.precision(12);
|
||||||
|
ZipStream.setf(ios::fixed,ios::floatfield);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZipWriter::ZipWriter(std::ostream& os)
|
ZipWriter::ZipWriter(std::ostream& os)
|
||||||
|
@ -188,6 +190,8 @@ ZipWriter::ZipWriter(std::ostream& os)
|
||||||
//FIXME: Check whether this is correct
|
//FIXME: Check whether this is correct
|
||||||
ZipStream.imbue(std::locale::classic());
|
ZipStream.imbue(std::locale::classic());
|
||||||
#endif
|
#endif
|
||||||
|
ZipStream.precision(12);
|
||||||
|
ZipStream.setf(ios::fixed,ios::floatfield);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZipWriter::writeFiles(void)
|
void ZipWriter::writeFiles(void)
|
||||||
|
|
|
@ -502,6 +502,73 @@ bool StdCmdToggleClipPlane::isActive(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEF_STD_CMD_ACL(StdCmdDrawStyle);
|
||||||
|
|
||||||
|
StdCmdDrawStyle::StdCmdDrawStyle()
|
||||||
|
: Command("Std_DrawStyle")
|
||||||
|
{
|
||||||
|
sGroup = QT_TR_NOOP("Standard-View");
|
||||||
|
sMenuText = QT_TR_NOOP("Draw style");
|
||||||
|
sToolTipText = QT_TR_NOOP("Draw style");
|
||||||
|
sStatusTip = QT_TR_NOOP("Draw style");
|
||||||
|
eType = Alter3DView;
|
||||||
|
}
|
||||||
|
|
||||||
|
Gui::Action * StdCmdDrawStyle::createAction(void)
|
||||||
|
{
|
||||||
|
Gui::ActionGroup* pcAction = new Gui::ActionGroup(this, Gui::getMainWindow());
|
||||||
|
pcAction->setDropDownMenu(true);
|
||||||
|
applyCommandData(pcAction);
|
||||||
|
|
||||||
|
QAction* a0 = pcAction->addAction(QString());
|
||||||
|
QAction* a1 = pcAction->addAction(QString());
|
||||||
|
_pcAction = pcAction;
|
||||||
|
languageChange();
|
||||||
|
return pcAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
void StdCmdDrawStyle::languageChange()
|
||||||
|
{
|
||||||
|
Command::languageChange();
|
||||||
|
|
||||||
|
if (!_pcAction)
|
||||||
|
return;
|
||||||
|
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
|
||||||
|
QList<QAction*> a = pcAction->actions();
|
||||||
|
|
||||||
|
a[0]->setText(QCoreApplication::translate(
|
||||||
|
"Std_DrawStyle", "As is", 0,
|
||||||
|
QCoreApplication::CodecForTr));
|
||||||
|
a[0]->setToolTip(QCoreApplication::translate(
|
||||||
|
"Std_DrawStyle", "Normal mode", 0,
|
||||||
|
QCoreApplication::CodecForTr));
|
||||||
|
|
||||||
|
a[1]->setText(QCoreApplication::translate(
|
||||||
|
"Std_DrawStyle", "Wireframe", 0,
|
||||||
|
QCoreApplication::CodecForTr));
|
||||||
|
a[1]->setToolTip(QCoreApplication::translate(
|
||||||
|
"Std_DrawStyle", "Wireframe mode", 0,
|
||||||
|
QCoreApplication::CodecForTr));
|
||||||
|
}
|
||||||
|
|
||||||
|
void StdCmdDrawStyle::activated(int iMsg)
|
||||||
|
{
|
||||||
|
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||||
|
if (view) {
|
||||||
|
SoQtViewer::DrawStyle style = SoQtViewer::VIEW_AS_IS;
|
||||||
|
if (iMsg == 0)
|
||||||
|
style = SoQtViewer::VIEW_AS_IS;
|
||||||
|
else if (iMsg == 1)
|
||||||
|
style = SoQtViewer::VIEW_LINE;
|
||||||
|
view->getViewer()->setDrawStyle(SoQtViewer::STILL, style);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool StdCmdDrawStyle::isActive(void)
|
||||||
|
{
|
||||||
|
return Gui::Application::Instance->activeDocument();
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
// Std_ToggleVisibility
|
// Std_ToggleVisibility
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
@ -1991,6 +2058,7 @@ void CreateViewStdCommands(void)
|
||||||
rcCmdMgr.addCommand(new StdOrthographicCamera());
|
rcCmdMgr.addCommand(new StdOrthographicCamera());
|
||||||
rcCmdMgr.addCommand(new StdPerspectiveCamera());
|
rcCmdMgr.addCommand(new StdPerspectiveCamera());
|
||||||
rcCmdMgr.addCommand(new StdCmdToggleClipPlane());
|
rcCmdMgr.addCommand(new StdCmdToggleClipPlane());
|
||||||
|
rcCmdMgr.addCommand(new StdCmdDrawStyle());
|
||||||
rcCmdMgr.addCommand(new StdCmdFreezeViews());
|
rcCmdMgr.addCommand(new StdCmdFreezeViews());
|
||||||
rcCmdMgr.addCommand(new StdViewZoomIn());
|
rcCmdMgr.addCommand(new StdViewZoomIn());
|
||||||
rcCmdMgr.addCommand(new StdViewZoomOut());
|
rcCmdMgr.addCommand(new StdViewZoomOut());
|
||||||
|
|
|
@ -166,7 +166,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
||||||
Gui::MenuItem* view = new Gui::MenuItem( menuBar );
|
Gui::MenuItem* view = new Gui::MenuItem( menuBar );
|
||||||
view->setCommand("&View");
|
view->setCommand("&View");
|
||||||
*view << "Std_ViewCreate" << "Std_OrthographicCamera" << "Std_PerspectiveCamera" << "Separator"
|
*view << "Std_ViewCreate" << "Std_OrthographicCamera" << "Std_PerspectiveCamera" << "Separator"
|
||||||
<< stdviews << "Std_FreezeViews" << "Separator" << view3d << zoom
|
<< stdviews << "Std_FreezeViews" << "Separator" << view3d << "Std_DrawStyle" << zoom
|
||||||
<< "Std_ViewDockUndockFullscreen" << "Std_AxisCross" << "Std_ToggleClipPlane"
|
<< "Std_ViewDockUndockFullscreen" << "Std_AxisCross" << "Std_ToggleClipPlane"
|
||||||
<< "Std_TextureMapping" << "Separator" << visu
|
<< "Std_TextureMapping" << "Separator" << visu
|
||||||
<< "Std_ToggleVisibility" << "Std_ToggleNavigation"
|
<< "Std_ToggleVisibility" << "Std_ToggleNavigation"
|
||||||
|
|
|
@ -424,6 +424,7 @@ void SoBrepFaceSet::renderShape(const SoGLCoordinateElement * const vertexlist,
|
||||||
materials->send(*matindices++, TRUE);
|
materials->send(*matindices++, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (normals) {
|
||||||
if (nbind == PER_VERTEX || nbind == PER_FACE) {
|
if (nbind == PER_VERTEX || nbind == PER_FACE) {
|
||||||
currnormal = normals++;
|
currnormal = normals++;
|
||||||
glNormal3fv((const GLfloat*)currnormal);
|
glNormal3fv((const GLfloat*)currnormal);
|
||||||
|
@ -432,6 +433,7 @@ void SoBrepFaceSet::renderShape(const SoGLCoordinateElement * const vertexlist,
|
||||||
currnormal = &normals[*normalindices++];
|
currnormal = &normals[*normalindices++];
|
||||||
glNormal3fv((const GLfloat*)currnormal);
|
glNormal3fv((const GLfloat*)currnormal);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (texture) {
|
if (texture) {
|
||||||
texcoords->send(texindices ? *texindices++ : texidx++,
|
texcoords->send(texindices ? *texindices++ : texidx++,
|
||||||
|
@ -447,6 +449,7 @@ void SoBrepFaceSet::renderShape(const SoGLCoordinateElement * const vertexlist,
|
||||||
else if (mbind == PER_VERTEX_INDEXED)
|
else if (mbind == PER_VERTEX_INDEXED)
|
||||||
materials->send(*matindices++, TRUE);
|
materials->send(*matindices++, TRUE);
|
||||||
|
|
||||||
|
if (normals) {
|
||||||
if (nbind == PER_VERTEX) {
|
if (nbind == PER_VERTEX) {
|
||||||
currnormal = normals++;
|
currnormal = normals++;
|
||||||
glNormal3fv((const GLfloat*)currnormal);
|
glNormal3fv((const GLfloat*)currnormal);
|
||||||
|
@ -455,6 +458,7 @@ void SoBrepFaceSet::renderShape(const SoGLCoordinateElement * const vertexlist,
|
||||||
currnormal = &normals[*normalindices++];
|
currnormal = &normals[*normalindices++];
|
||||||
glNormal3fv((const GLfloat*)currnormal);
|
glNormal3fv((const GLfloat*)currnormal);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (texture) {
|
if (texture) {
|
||||||
texcoords->send(texindices ? *texindices++ : texidx++,
|
texcoords->send(texindices ? *texindices++ : texidx++,
|
||||||
|
@ -470,6 +474,7 @@ void SoBrepFaceSet::renderShape(const SoGLCoordinateElement * const vertexlist,
|
||||||
else if (mbind == PER_VERTEX_INDEXED)
|
else if (mbind == PER_VERTEX_INDEXED)
|
||||||
materials->send(*matindices++, TRUE);
|
materials->send(*matindices++, TRUE);
|
||||||
|
|
||||||
|
if (normals) {
|
||||||
if (nbind == PER_VERTEX) {
|
if (nbind == PER_VERTEX) {
|
||||||
currnormal = normals++;
|
currnormal = normals++;
|
||||||
glNormal3fv((const GLfloat*)currnormal);
|
glNormal3fv((const GLfloat*)currnormal);
|
||||||
|
@ -478,6 +483,7 @@ void SoBrepFaceSet::renderShape(const SoGLCoordinateElement * const vertexlist,
|
||||||
currnormal = &normals[*normalindices++];
|
currnormal = &normals[*normalindices++];
|
||||||
glNormal3fv((const GLfloat*)currnormal);
|
glNormal3fv((const GLfloat*)currnormal);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (texture) {
|
if (texture) {
|
||||||
texcoords->send(texindices ? *texindices++ : texidx++,
|
texcoords->send(texindices ? *texindices++ : texidx++,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user