Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
TypeSkyDome.cc
1 /*===========================================================================*\
2 * *
3 * OpenFlipper *
4 * Copyright (C) 2001-2014 by Computer Graphics Group, RWTH Aachen *
5 * www.openflipper.org *
6 * *
7 *--------------------------------------------------------------------------- *
8 * This file is part of OpenFlipper. *
9 * *
10 * OpenFlipper is free software: you can redistribute it and/or modify *
11 * it under the terms of the GNU Lesser General Public License as *
12 * published by the Free Software Foundation, either version 3 of *
13 * the License, or (at your option) any later version with the *
14 * following exceptions: *
15 * *
16 * If other files instantiate templates or use macros *
17 * or inline functions from this file, or you compile this file and *
18 * link it with other files to produce an executable, this file does *
19 * not by itself cause the resulting executable to be covered by the *
20 * GNU Lesser General Public License. This exception does not however *
21 * invalidate any other reasons why the executable file might be *
22 * covered by the GNU Lesser General Public License. *
23 * *
24 * OpenFlipper is distributed in the hope that it will be useful, *
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
27 * GNU Lesser General Public License for more details. *
28 * *
29 * You should have received a copy of the GNU LesserGeneral Public *
30 * License along with OpenFlipper. If not, *
31 * see <http://www.gnu.org/licenses/>. *
32 * *
33 \*===========================================================================*/
34 
35 /*===========================================================================*\
36 * *
37 * $Revision: 15115 $ *
38 * $LastChangedBy: moebius $ *
39 * $Date: 2012-07-26 14:40:06 +0200 (Do, 26 Jul 2012) $ *
40 * *
41 \*===========================================================================*/
42 
43 
44 #include "TypeSkyDome.hh"
45 
47 
48 TypeSkyDomePlugin::TypeSkyDomePlugin() {
49 
50 }
51 
52 bool TypeSkyDomePlugin::registerType() {
53  addDataType("SkyDome",tr("SkyDome"));
54  setTypeIcon( "SkyDome", "SkyDomeType.png");
55  return true;
56 }
57 
59 
60  // new object data struct
61  SkyDomeObject * object = new SkyDomeObject();
62 
63  if ( PluginFunctions::objectCount() == 1 )
64  object->target(true);
65 
66  if (PluginFunctions::targetCount() == 0 )
67  object->target(true);
68 
69  QString name = QString(tr("New SkyDome %1.sky").arg( object->id() ));
70 
71  // call the local function to update names
72  QFileInfo f(name);
73  object->setName( f.fileName() );
74 
75  object->update();
76 
77  object->show();
78 
79  emit emptyObjectAdded (object->id() );
80 
81  return object->id();
82 }
83 
84 #if QT_VERSION < 0x050000
85 Q_EXPORT_PLUGIN2( typeskydomeplugin , TypeSkyDomePlugin );
86 #endif
int addEmpty()
Create an empty object.
Definition: TypeSkyDome.cc:58
int id() const
Definition: BaseObject.cc:201
QString name()
Return a name for the plugin.
Definition: TypeSkyDome.hh:82
DLLEXPORT void setTypeIcon(DataType _id, QString _icon)
Set an Icon for a given DataType.
Definition: Types.cc:234
int objectCount()
Get the number of available objects.
DLLEXPORT DataType addDataType(QString _name, QString _readableName)
Adds a datatype and returns the id for the new type.
Definition: Types.cc:128
int targetCount()
Get the number of target objects.