1 /*---------------------------------------------------------------------------*\
5 * Copyright (C) 2009 by the OpenSG Forum *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
39 #if __GNUC__ >= 4 || __GNUC_MINOR__ >=3
40 #pragma GCC diagnostic ignored "-Wold-style-cast"
43 #include "OSGColladaInstanceNode.h"
45 #if defined(OSG_WITH_COLLADA) || defined(OSG_DO_DOC)
47 #include "OSGColladaLog.h"
51 ColladaElementRegistrationHelper
ColladaInstanceNode::_regHelper(
52 &ColladaInstanceNode::create
,
56 ColladaElementTransitPtr
57 ColladaInstanceNode::create(daeElement
*elem
, ColladaGlobal
*global
)
59 return ColladaElementTransitPtr(new ColladaInstanceNode(elem
, global
));
63 ColladaInstanceNode::read(ColladaElement
*colElemParent
)
65 OSG_COLLADA_LOG(("ColladaInstanceNode::read\n"));
67 ColladaNodeRefPtr colNode
= getTargetElem();
71 colNode
= dynamic_pointer_cast
<ColladaNode
>(
72 ColladaElementFactory::the()->create(
73 getTargetDOMElem(), getGlobal()));
80 ColladaInstanceNode::getTargetElem(void) const
82 ColladaNode
*retVal
= NULL
;
83 daeElementRef targetElem
= getTargetDOMElem();
85 if(targetElem
!= NULL
)
87 retVal
= getUserDataAs
<ColladaNode
>(targetElem
);
94 ColladaInstanceNode::getTargetDOMElem(void) const
96 domNodeRef retVal
= NULL
;
97 domInstance_nodeRef instNode
= getDOMElementAs
<domInstance_node
>();
99 if(instNode
->getUrl().getElement() != NULL
)
101 retVal
= daeSafeCast
<domNode
>(instNode
->getUrl().getElement());
107 ColladaInstanceNode::ColladaInstanceNode(
108 daeElement
*elem
, ColladaGlobal
*global
)
110 : Inherited(elem
, global
)
114 ColladaInstanceNode::~ColladaInstanceNode(void)
120 #endif // OSG_WITH_COLLADA