00001 #include "GLCreatorShapeVisitor.h" 00002 #include "Appearance.h" 00003 #include "FillProperties.h" 00004 #include "LineProperties.h" 00005 #include "Material.h" 00006 #include "Shape.h" 00007 #include "GLAppearance.h" 00008 #include "GLFillProperties.h" 00009 #include "GLLineProperties.h" 00010 #include "GLMaterial.h" 00011 #include "GLShape.h" 00012 00013 using namespace X3DTK; 00014 00015 GLCreatorShapeVisitor::GLCreatorShapeVisitor() 00016 : ShapeVisitor() 00017 { 00018 // Enter functions. 00019 defineNewEnterFunction<GLCreatorShapeVisitor, Appearance>(&GLCreatorShapeVisitor::enterAppearance); 00020 defineNewEnterFunction<GLCreatorShapeVisitor, FillProperties>(&GLCreatorShapeVisitor::enterFillProperties); 00021 defineNewEnterFunction<GLCreatorShapeVisitor, LineProperties>(&GLCreatorShapeVisitor::enterLineProperties); 00022 defineNewEnterFunction<GLCreatorShapeVisitor, Material>(&GLCreatorShapeVisitor::enterMaterial); 00023 defineNewEnterFunction<GLCreatorShapeVisitor, Shape>(&GLCreatorShapeVisitor::enterShape); 00024 00025 // GlobalVariables assignation. 00026 globalVariables = GVManager::getInstanceOf<GLCreatorGlobalVariables>(); 00027 } 00028 00029 GLCreatorShapeVisitor::~GLCreatorShapeVisitor() 00030 { 00031 } 00032 00033 void GLCreatorShapeVisitor::enterAppearance(Appearance *A) const 00034 { 00035 GLAppearance *GA = new GLAppearance(); 00036 GA->setLink(A); 00037 globalVariables->getTop()->addChild(GA); 00038 globalVariables->pushNode(GA); 00039 } 00040 00041 void GLCreatorShapeVisitor::enterFillProperties(FillProperties *F) const 00042 { 00043 GLFillProperties *GF = new GLFillProperties(); 00044 GF->setLink(F); 00045 globalVariables->getTop()->addChild(GF); 00046 globalVariables->pushNode(GF); 00047 } 00048 00049 void GLCreatorShapeVisitor::enterLineProperties(LineProperties *L) const 00050 { 00051 GLLineProperties *GL = new GLLineProperties(); 00052 GL->setLink(L); 00053 globalVariables->getTop()->addChild(GL); 00054 globalVariables->pushNode(GL); 00055 } 00056 00057 void GLCreatorShapeVisitor::enterMaterial(Material *M) const 00058 { 00059 GLMaterial *GM = new GLMaterial(); 00060 GM->setLink(M); 00061 globalVariables->getTop()->addChild(GM); 00062 globalVariables->pushNode(GM); 00063 } 00064 00065 void GLCreatorShapeVisitor::enterShape(Shape *S) const 00066 { 00067 GLShape *GS = new GLShape(); 00068 GS->setLink(S); 00069 globalVariables->getTop()->addChild(GS); 00070 globalVariables->pushNode(GS); 00071 } 00072