本文整理汇总了C++中Property::Evaluate方法的典型用法代码示例。如果您正苦于以下问题:C++ Property::Evaluate方法的具体用法?C++ Property::Evaluate怎么用?C++ Property::Evaluate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Property
的用法示例。
在下文中一共展示了Property::Evaluate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPropertyGridChange
void CPropertiesCanvas::OnPropertyGridChange( wxPropertyGridEvent& event ) {
wxPGProperty* p = event.GetPropertyPtr();
Property* property = GetProperty(p);
if(property == NULL)return;
wxGetApp().CreateUndoPoint();
switch(property->get_property_type()){
case StringPropertyType:
{
wxString value;
if (property->Evaluate(GetProperties(), event.GetPropertyValue().GetString(), value))
{
(*(((PropertyString*)property)->m_callbackfunc))(value, ((PropertyString*)property)->m_object);
}
}
break;
case DoublePropertyType:
{
wxString value;
if (property->Evaluate(GetProperties(), event.GetPropertyValue().GetString(), value))
{
(*(((PropertyDouble*)property)->m_callbackfunc))(strtod(value.utf8_str(),NULL), ((PropertyDouble*)property)->m_object);
}
}
break;
case LengthPropertyType:
{
wxString value;
if (property->Evaluate(GetProperties(), event.GetPropertyValue().GetString(), value))
{
(*(((PropertyLength*)property)->m_callbackfunc))(strtod(value.utf8_str(),NULL) * wxGetApp().m_view_units, ((PropertyDouble*)property)->m_object);
}
}
break;
case IntPropertyType:
{
(*(((PropertyInt*)property)->m_callbackfunc))(event.GetPropertyValue().GetLong(), ((PropertyInt*)property)->m_object);
}
break;
case ColorPropertyType:
{
wxVariant var = event.GetPropertyValue();
const wxColour* wcol = wxGetVariantCast(var,wxColour);
HeeksColor col(wcol->Red(), wcol->Green(), wcol->Blue());
(*(((PropertyColor*)property)->m_callbackfunc))(col, ((PropertyColor*)property)->m_object);
}
break;
case VertexPropertyType:
{
if(p->GetName()[0] == 'x'){
((PropertyVertex*)property)->m_x[0] = event.GetPropertyValue().GetDouble();
if(((PropertyVertex*)property)->m_affected_by_view_units)((PropertyVertex*)property)->m_x[0] *= wxGetApp().m_view_units;
}
else if(p->GetName()[0] == 'y'){
((PropertyVertex*)property)->m_x[1] = event.GetPropertyValue().GetDouble();
if(((PropertyVertex*)property)->m_affected_by_view_units)((PropertyVertex*)property)->m_x[1] *= wxGetApp().m_view_units;
}
else if(p->GetName()[0] == 'z'){
((PropertyVertex*)property)->m_x[2] = event.GetPropertyValue().GetDouble();
if(((PropertyVertex*)property)->m_affected_by_view_units)((PropertyVertex*)property)->m_x[2] *= wxGetApp().m_view_units;
}
(*(((PropertyVertex*)property)->m_callbackfunc))(((PropertyVertex*)property)->m_x, ((PropertyVertex*)property)->m_object);
}
break;
case TrsfPropertyType:
{
double pos[3];
extract(((PropertyTrsf*)property)->m_trsf.TranslationPart(), pos);
gp_Dir xaxis(1, 0, 0);
xaxis.Transform(((PropertyTrsf*)p)->m_trsf);
gp_Dir yaxis(0, 1, 0);
yaxis.Transform(((PropertyTrsf*)p)->m_trsf);
double vertical_angle = 0;
double horizontal_angle = 0;
double twist_angle = 0;
CoordinateSystem::AxesToAngles(xaxis, yaxis, vertical_angle, horizontal_angle, twist_angle);
if(p->GetName()[0] == 'x'){
pos[0] = event.GetPropertyValue().GetDouble();
}
else if(p->GetName()[0] == 'y'){
pos[1] = event.GetPropertyValue().GetDouble();
}
else if(p->GetName()[0] == 'z'){
pos[2] = event.GetPropertyValue().GetDouble();
}
else if(p->GetName()[0] == 'v'){
vertical_angle = event.GetPropertyValue().GetDouble();
}
else if(p->GetName()[0] == 'h'){
horizontal_angle = event.GetPropertyValue().GetDouble();
}
else if(p->GetName()[0] == 't'){
twist_angle = event.GetPropertyValue().GetDouble();
}
//.........这里部分代码省略.........