Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CAMP
campvis-public
Commits
1fe8450d
Commit
1fe8450d
authored
Dec 14, 2014
by
Hossain Mahmud
Browse files
selectById added
parent
46792701
Changes
25
Hide whitespace changes
Inline
Side-by-side
application/gui/properties/geometry1dtransferfunctioneditor.cpp
View file @
1fe8450d
...
...
@@ -190,9 +190,7 @@ namespace campvis {
tbb
::
mutex
::
scoped_lock
lock
(
_localMutex
);
float
pos
=
static_cast
<
float
>
(
e
->
x
())
/
static_cast
<
float
>
(
_canvas
->
width
());
cgt
::
col4
col
=
cgt
::
col4
(
255
);
float
alpha
=
cgt
::
clamp
(
static_cast
<
float
>
(
_canvas
->
height
()
-
e
->
y
())
/
static_cast
<
float
>
(
_canvas
->
height
()),
0.
f
,
1.
f
);
col
.
a
=
static_cast
<
uint8_t
>
(
alpha
*
255.
f
);
g
->
addKeyPoint
(
pos
,
alpha
);
}
...
...
core/bindings/campvis.i
View file @
1fe8450d
...
...
@@ -185,6 +185,37 @@ namespace campvis {
%
template
(
Vec4Property
)
FloatingPointProperty
<
cgt
::
Vector4
<
float
>
>
;
typedef
FloatingPointProperty
<
cgt
::
Vector4
<
float
>
>
Vec4Property
;
/* OptionProperty */
class
AbstractOptionProperty
:
public
IntProperty
{
public
:
AbstractOptionProperty
(
const
std
::
string&
name
,
const
std
::
string&
title
)
;
virtual
~
AbstractOptionProperty
()
;
virtual
const
std
::
string&
getOptionId
()
=
0
;
virtual
void
selectById
(
const
std
::
string&
id
)
=
0
;
}
;
template
<
typename
T
>
class
GenericOptionProperty
:
public
AbstractOptionProperty
{
public
:
GenericOptionProperty
(
const
std
::
string&
name
,
const
std
::
string&
title
,
const
GenericOption
<
T
>*
options
,
int
count
)
;
virtual
~
GenericOptionProperty
()
;
const
std
::
string&
getOptionId
()
;
void
selectById
(
const
std
::
string&
id
)
;
}
;
/* Downcast the return value of selectById to appropriate subclass */
%
factory
(
void
campvis
::
AbstractOptionProperty
::
selectById
,
campvis
::
GenericOptionProperty
)
;
/* Downcast the return value of getOptionId to appropriate subclass */
%
factory
(
void
campvis
::
AbstractOptionProperty
::
getOptionId
,
campvis
::
GenericOptionProperty
)
;
/* TFGeometry1D */
%
nodefaultctor
TFGeometry1D
;
...
...
@@ -341,17 +372,22 @@ namespace campvis {
sigslot
::
signal0
s_changed
;
%
mutable
;
}
;
/* Down casting or super classes.
* Down casting follows the order of declaration.
* Declare the classes as child first according to the class hierarchy.
*/
/* Downcast the return value of HasPropertyCollection::getProperty to appropriate subclass */
%
factory
(
AbstractProperty
*
campvis
::
HasPropertyCollection
::
getProperty
,
campvis
::
IntProperty
,
campvis
::
IVec2Property
,
campvis
::
IVec3Property
,
campvis
::
IVec4Property
,
campvis
::
AbstractOptionProperty
,
campvis
::
IntProperty
,
campvis
::
IVec2Property
,
campvis
::
IVec3Property
,
campvis
::
IVec4Property
,
campvis
::
FloatProperty
,
campvis
::
Vec2Property
,
campvis
::
Vec3Property
,
campvis
::
Vec4Property
,
campvis
::
TransferFunctionProperty
,
campvis
::
DataNameProperty
,
campvis
::
StringProperty
,
campvis
::
ButtonProperty
,
campvis
::
BoolProperty
)
;
/* Downcast the return value of HasPropertyCollection::getNestedProperty to appropriate subclass */
%
factory
(
AbstractProperty
*
campvis
::
HasPropertyCollection
::
getNestedProperty
,
campvis
::
IntProperty
,
campvis
::
IVec2Property
,
campvis
::
IVec3Property
,
campvis
::
IVec4Property
,
campvis
::
AbstractOptionProperty
,
campvis
::
IntProperty
,
campvis
::
IVec2Property
,
campvis
::
IVec3Property
,
campvis
::
IVec4Property
,
campvis
::
FloatProperty
,
campvis
::
Vec2Property
,
campvis
::
Vec3Property
,
campvis
::
Vec4Property
,
campvis
::
TransferFunctionProperty
,
campvis
::
DataNameProperty
,
campvis
::
StringProperty
,
campvis
::
ButtonProperty
,
campvis
::
BoolProperty
)
;
...
...
core/classification/tfgeometry1d.cpp
View file @
1fe8450d
...
...
@@ -139,15 +139,16 @@ namespace campvis {
void
TFGeometry1D
::
addKeyPoint
(
float
position
,
float
alpha
)
{
TFGeometry1D
::
KeyPoint
kp
(
position
,
cgt
::
col4
(
255
));
cgt
::
col4
color
(
255
);
std
::
vector
<
TFGeometry1D
::
KeyPoint
>::
iterator
lb
=
std
::
upper_bound
(
_keyPoints
.
begin
(),
_keyPoints
.
end
(),
kp
);
if
(
lb
!=
_keyPoints
.
end
())
{
kp
.
_
color
=
lb
->
_color
;
color
=
lb
->
_color
;
}
else
{
kp
.
_
color
=
_keyPoints
.
back
().
_color
;
color
=
_keyPoints
.
back
().
_color
;
}
kp
.
_
color
.
a
=
static_cast
<
uint8_t
>
(
alpha
*
255.
f
);
_k
eyPoint
s
.
insert
(
lb
,
kp
);
color
.
a
=
static_cast
<
uint8_t
>
(
alpha
*
255.
f
);
addK
eyPoint
(
position
,
color
);
}
void
TFGeometry1D
::
addKeyPoint
(
float
position
,
const
cgt
::
col4
&
color
)
{
...
...
core/properties/optionproperty.h
View file @
1fe8450d
...
...
@@ -52,6 +52,19 @@ namespace campvis {
* Pure virtual destructor.
*/
virtual
~
AbstractOptionProperty
()
{};
/**
* Returns the id of the currently selected option.
* \return _options[_value]._id
*/
virtual
const
std
::
string
&
getOptionId
()
=
0
;
/**
* Sets the selected option to the first option with the given id.
* If no such option is found, the selected option will not change.
* \param id Id of the option to select.
*/
virtual
void
selectById
(
const
std
::
string
&
id
)
=
0
;
/**
* Returns all Options als pair of std::strings.
...
...
@@ -146,7 +159,7 @@ namespace campvis {
* Returns the id of the currently selected option.
* \return _options[_value]._id
*/
std
::
string
&
getOptionId
()
const
;
const
std
::
string
&
getOptionId
();
/**
...
...
@@ -252,7 +265,7 @@ namespace campvis {
}
template
<
typename
T
>
std
::
string
&
campvis
::
GenericOptionProperty
<
T
>::
getOptionId
()
const
{
const
std
::
string
&
campvis
::
GenericOptionProperty
<
T
>::
getOptionId
()
{
return
_options
[
_value
].
_id
;
}
...
...
scripting/luagen/properties/abstractpropertylua.h
View file @
1fe8450d
...
...
@@ -53,7 +53,7 @@ namespace campvis {
*/
virtual
~
AbstractPropertyLua
();
public:
virtual
std
::
string
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
)
=
0
;
virtual
std
::
string
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
)
=
0
;
protected:
AbstractProperty
*
_property
;
///< The property this lua handles
...
...
scripting/luagen/properties/boolpropertylua.cpp
View file @
1fe8450d
...
...
@@ -34,7 +34,7 @@ namespace campvis {
BoolPropertyLua
::~
BoolPropertyLua
()
{
}
std
::
string
BoolPropertyLua
::
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
)
{
std
::
string
BoolPropertyLua
::
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
)
{
std
::
string
ret
=
""
;
ret
+=
luaProc
;
ret
+=
"getNestedProperty(
\"
"
+
propNamePrefix
+
_property
->
getName
()
+
"
\"
):setValue("
...
...
scripting/luagen/properties/boolpropertylua.h
View file @
1fe8450d
...
...
@@ -46,7 +46,7 @@ namespace campvis {
*/
virtual
~
BoolPropertyLua
();
std
::
string
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
);
std
::
string
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
);
};
// explicitly instantiate template, so that it gets registered also over DLL boundaries.
...
...
scripting/luagen/properties/colorpropertylua.cpp
View file @
1fe8450d
...
...
@@ -35,7 +35,7 @@ namespace campvis {
ColorPropertyLua
::~
ColorPropertyLua
()
{
}
std
::
string
ColorPropertyLua
::
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
)
{
std
::
string
ColorPropertyLua
::
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
)
{
cgt
::
vec4
value
=
static_cast
<
ColorProperty
*>
(
_property
)
->
getValue
();
std
::
string
ret
=
""
;
ret
+=
luaProc
;
...
...
scripting/luagen/properties/colorpropertylua.h
View file @
1fe8450d
...
...
@@ -48,7 +48,7 @@ namespace campvis {
*/
virtual
~
ColorPropertyLua
();
std
::
string
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
);
std
::
string
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
);
};
// ================================================================================================
...
...
scripting/luagen/properties/datanamepropertylua.cpp
View file @
1fe8450d
...
...
@@ -35,7 +35,7 @@ namespace campvis {
DataNamePropertyLua
::~
DataNamePropertyLua
()
{
}
std
::
string
DataNamePropertyLua
::
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
)
{
std
::
string
DataNamePropertyLua
::
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
)
{
const
std
::
string
value
=
static_cast
<
DataNameProperty
*>
(
_property
)
->
getValue
();
std
::
string
ret
=
""
;
ret
+=
luaProc
;
...
...
scripting/luagen/properties/datanamepropertylua.h
View file @
1fe8450d
...
...
@@ -53,7 +53,7 @@ namespace campvis {
*/
virtual
~
DataNamePropertyLua
();
std
::
string
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
);
std
::
string
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
);
};
// explicitly instantiate template, so that it gets registered also over DLL boundaries.
...
...
scripting/luagen/properties/floatpropertylua.cpp
View file @
1fe8450d
...
...
@@ -35,7 +35,7 @@ namespace campvis {
FloatProperty
*
property
=
static_cast
<
FloatProperty
*>
(
_property
);
}
std
::
string
FloatPropertyLua
::
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
)
{
std
::
string
FloatPropertyLua
::
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
)
{
std
::
string
ret
=
""
;
ret
+=
luaProc
;
ret
+=
"getNestedProperty(
\"
"
+
propNamePrefix
+
_property
->
getName
()
+
"
\"
):setValue("
...
...
scripting/luagen/properties/floatpropertylua.h
View file @
1fe8450d
...
...
@@ -48,7 +48,7 @@ namespace campvis {
*/
virtual
~
FloatPropertyLua
();
std
::
string
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
);
std
::
string
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
);
};
...
...
@@ -102,7 +102,7 @@ namespace campvis {
*/
virtual
~
VecPropertyLua
();
virtual
std
::
string
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
);
virtual
std
::
string
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
);
};
...
...
@@ -120,7 +120,7 @@ namespace campvis {
}
template
<
size_t
SIZE
>
std
::
string
VecPropertyLua
<
SIZE
>::
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
)
{
std
::
string
VecPropertyLua
<
SIZE
>::
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
)
{
std
::
string
ret
=
"-- NOT IMPLEMENTED VecProperty"
;
return
ret
;
}
...
...
@@ -133,7 +133,7 @@ namespace campvis {
{
}
std
::
string
Vec2PropertyLua
::
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
)
{
std
::
string
Vec2PropertyLua
::
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
)
{
cgt
::
vec2
value
=
static_cast
<
Vec2Property
*>
(
_property
)
->
getValue
();
std
::
string
ret
=
""
;
ret
+=
luaProc
;
...
...
@@ -151,7 +151,7 @@ namespace campvis {
:
VecPropertyLua
<
3
>
(
property
,
dataContainer
)
{
}
std
::
string
Vec3PropertyLua
::
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
)
{
std
::
string
Vec3PropertyLua
::
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
)
{
cgt
::
vec3
value
=
static_cast
<
Vec3Property
*>
(
_property
)
->
getValue
();
std
::
string
ret
=
""
;
ret
+=
luaProc
;
...
...
@@ -171,7 +171,7 @@ namespace campvis {
{
}
std
::
string
Vec4PropertyLua
::
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
)
{
std
::
string
Vec4PropertyLua
::
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
)
{
cgt
::
vec4
value
=
static_cast
<
Vec4Property
*>
(
_property
)
->
getValue
();
std
::
string
ret
=
""
;
ret
+=
luaProc
;
...
...
scripting/luagen/properties/intpropertylua.cpp
View file @
1fe8450d
...
...
@@ -34,7 +34,7 @@ namespace campvis {
IntPropertyLua
::~
IntPropertyLua
()
{
}
std
::
string
IntPropertyLua
::
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
)
{
std
::
string
IntPropertyLua
::
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
)
{
std
::
string
ret
=
""
;
ret
+=
luaProc
;
ret
+=
"getNestedProperty(
\"
"
+
propNamePrefix
+
_property
->
getName
()
+
"
\"
):setValue("
...
...
scripting/luagen/properties/intpropertylua.h
View file @
1fe8450d
...
...
@@ -48,7 +48,7 @@ namespace campvis {
*/
virtual
~
IntPropertyLua
();
std
::
string
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
);
std
::
string
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
);
};
// explicitly instantiate template, so that it gets registered also over DLL boundaries.
...
...
@@ -101,7 +101,7 @@ namespace campvis {
*/
virtual
~
IVecPropertyLua
();
virtual
std
::
string
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
);
virtual
std
::
string
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
);
};
// ================================================================================================
...
...
@@ -117,7 +117,7 @@ namespace campvis {
}
template
<
size_t
SIZE
>
std
::
string
IVecPropertyLua
<
SIZE
>::
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
)
{
std
::
string
IVecPropertyLua
<
SIZE
>::
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
)
{
std
::
string
ret
=
"-- NOT IMPLEMENTED IVecProperty"
;
return
ret
;
}
...
...
@@ -131,7 +131,7 @@ namespace campvis {
{
}
std
::
string
IVec2PropertyLua
::
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
)
{
std
::
string
IVec2PropertyLua
::
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
)
{
cgt
::
ivec2
value
=
static_cast
<
IVec2Property
*>
(
_property
)
->
getValue
();
std
::
string
ret
=
""
;
ret
+=
luaProc
;
...
...
@@ -150,7 +150,7 @@ namespace campvis {
{
}
std
::
string
IVec3PropertyLua
::
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
)
{
std
::
string
IVec3PropertyLua
::
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
)
{
cgt
::
ivec3
value
=
static_cast
<
IVec3Property
*>
(
_property
)
->
getValue
();
std
::
string
ret
=
""
;
ret
+=
luaProc
;
...
...
@@ -170,7 +170,7 @@ namespace campvis {
{
}
std
::
string
IVec4PropertyLua
::
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
)
{
std
::
string
IVec4PropertyLua
::
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
)
{
cgt
::
ivec4
value
=
static_cast
<
IVec4Property
*>
(
_property
)
->
getValue
();
std
::
string
ret
=
""
;
ret
+=
luaProc
;
...
...
scripting/luagen/properties/metapropertylua.cpp
View file @
1fe8450d
...
...
@@ -36,7 +36,7 @@ namespace campvis {
MetaPropertyLua
::~
MetaPropertyLua
()
{
}
std
::
string
MetaPropertyLua
::
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
)
{
std
::
string
MetaPropertyLua
::
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
)
{
return
PropertyCollectionLuaScriptGenerator
::
getLuaScript
(
propNamePrefix
+
_property
->
getName
()
+
"::"
,
luaProc
);
}
...
...
scripting/luagen/properties/metapropertylua.h
View file @
1fe8450d
...
...
@@ -51,7 +51,7 @@ namespace campvis {
*/
virtual
~
MetaPropertyLua
();
std
::
string
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
);
std
::
string
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
);
private:
MetaProperty
*
_property
;
...
...
scripting/luagen/properties/optionpropertylua.cpp
View file @
1fe8450d
...
...
@@ -35,11 +35,11 @@ namespace campvis {
OptionPropertyLua
::~
OptionPropertyLua
()
{
}
std
::
string
OptionPropertyLua
::
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
)
{
std
::
string
OptionPropertyLua
::
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
)
{
std
::
string
ret
=
""
;
ret
+=
luaProc
;
ret
+=
"getNestedProperty(
\"
"
+
propNamePrefix
+
_property
->
getName
()
+
"
\"
):se
tValue(
"
+
StringUtils
::
toString
(
static_cast
<
AbstractOptionProperty
*>
(
_property
)
->
get
Value
()
)
+
")"
;
ret
+=
"getNestedProperty(
\"
"
+
propNamePrefix
+
_property
->
getName
()
+
"
\"
):se
lectById(
\"
"
+
StringUtils
::
toString
(
static_cast
<
AbstractOptionProperty
*>
(
_property
)
->
get
OptionId
()
)
+
"
\
"
)"
;
return
ret
;
}
...
...
scripting/luagen/properties/optionpropertylua.h
View file @
1fe8450d
...
...
@@ -49,7 +49,7 @@ namespace campvis {
*/
virtual
~
OptionPropertyLua
();
std
::
string
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
);
std
::
string
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
);
};
// explicitly instantiate template, so that it gets registered also over DLL boundaries.
...
...
scripting/luagen/properties/propertycollectionluascriptgenerator.cpp
View file @
1fe8450d
...
...
@@ -64,7 +64,7 @@ namespace campvis {
}
}
std
::
string
PropertyCollectionLuaScriptGenerator
::
getLuaScript
(
std
::
string
&
propNamePrefix
,
std
::
string
&
luaProc
)
{
std
::
string
PropertyCollectionLuaScriptGenerator
::
getLuaScript
(
const
std
::
string
&
propNamePrefix
,
const
std
::
string
&
luaProc
)
{
std
::
string
ret
=
""
;
for
(
std
::
map
<
AbstractProperty
*
,
AbstractPropertyLua
*>::
iterator
it
=
_luaMap
.
begin
();
it
!=
_luaMap
.
end
();
++
it
)
{
ret
+=
it
->
second
->
getLuaScript
(
propNamePrefix
,
luaProc
)
+
"
\n
"
;
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment