source: NonGTP/FCollada/FCDocument/FCDExternalReference.h @ 964

Revision 964, 3.5 KB checked in by igarcia, 19 years ago (diff)
Line 
1/*
2        Copyright (C) 2005-2006 Feeling Software Inc.
3        MIT License: http://www.opensource.org/licenses/mit-license.php
4*/
5/*
6        Based on the FS Import classes:
7        Copyright (C) 2005-2006 Feeling Software Inc
8        Copyright (C) 2005-2006 Autodesk Media Entertainment
9        MIT License: http://www.opensource.org/licenses/mit-license.php
10*/
11
12/**
13        @file FCDExternalReference.h
14        This file contains the FCDExternalReference class.
15*/
16
17#ifndef _FCD_XREF_ENTITY_H_
18#define _FCD_XREF_ENTITY_H_
19
20#include "FCDocument/FCDEntityInstance.h"
21#include "FUtils/FUStringConversion.h"
22#include "FUtils/FUUri.h"
23
24/**
25        A COLLADA external reference for an entity instance.
26        COLLADA supports many types of external references.
27        FCollada only exposes external references within the visual scene graph.
28
29        @ingroup FCDocument
30*/
31class FCOLLADA_EXPORT FCDExternalReference : public FCDEntityInstance
32{
33private:
34        DeclareObjectType;
35
36        FCDEntity::Type entityType;
37        FUUri uri;
38
39public:
40        /** Constructor: do not use directly.
41                Instead, use the appropriate allocation function.
42                For visual scene node instances: FCDSceneNode::AddInstance,
43                with the entity pointer set to NULL.
44                @param document The COLLADA document that owns the reference.
45                @param uri The URI of the referenced entity. */
46        FCDExternalReference(FCDocument* document, const FUUri& uri);
47
48        /** Destructor: do not use directly.
49                Instead, use the appropriate release function.
50                For visual scene node instances: FCDSceneNode::ReleaseInstance. */
51        virtual ~FCDExternalReference() {}
52
53        /** Retrieves the entity instance class type.
54                @return The class type: EXTERNAL_REFERENCE. */
55        virtual Type GetType() const { return EXTERNAL_REFERENCE; }
56
57        /** Retrieves the type of the entity that is referenced.
58                @return The type of the external entity. */
59        inline FCDEntity::Type GetEntityType() const { return entityType; }
60
61        /** Sets the type of the entity that is referenced.
62                @param type The type of the external entity. */
63        inline void SetEntityType(FCDEntity::Type type) { entityType = type; }
64
65        /** Retrieves the URI of the external reference.
66                This points to the COLLADA document and the id of the referenced entity.
67                @return The referenced entity URI. */
68        inline const FUUri& GetUri() const { return uri; }
69
70        /** Sets the URI of the external reference.
71                This points to the COLLADA document and the id of the referenced entity.
72                @param _uri The referenced entity URL. */
73        inline void SetUri(const FUUri& _uri) { uri = _uri; }
74
75        /** Retrieves the filename of the COLLADA document referenced.
76                @return The referenced document filename. */
77        inline const fstring& GetFilename() const { return uri.prefix; }
78
79        /** Sets the filename of the COLLADA document referenced.
80                @param filename The referenced document filename. */
81        void SetFilename(const fchar* filename);
82        inline void SetFilename(const fstring& filename) { SetFilename(filename.c_str()); } /**< See above. */
83
84        /** Retrieves the COLLADA id of the external entity.
85                @return The COLLADA id. */
86        inline fstring GetObjectId() const { return TO_FSTRING(uri.suffix); }
87
88        /** Sets the COLLADA id of the external entity.
89                @param daeId The COLLADA id. */
90        inline void SetObjectId(const fchar* daeId) { uri.suffix = TO_STRING(daeId); }
91        inline void SetObjectId(const fstring& daeId) { uri.suffix = TO_STRING(daeId); } /**< See above. */
92
93        /** [INTERNAL] Writes out the entity instance to the given COLLADA XML tree node.
94                @param parentNode The COLLADA XML parent node in which to insert the node.
95                @return The created XML tree node. */
96        virtual xmlNode* WriteToXML(xmlNode* parentNode) const;
97};
98
99#endif // _FCD_XREF_ENTITY_H_
Note: See TracBrowser for help on using the repository browser.