Ejemplo n.º 1
0
bool CIwGameUITextView::setProperty(unsigned int element_name, CIwGameString& data, bool delta)
{
	if (CIwGameUIBase::setProperty(element_name, data, delta))
		return true;

	if (element_name == CIwGameXomlNames::MinZoom_Hash)
	{
		if (delta)
			setMinZoom(MinZoom + data.GetAsFloat());
		else
			setMinZoom(data.GetAsFloat());
	}
	else
	if (element_name == CIwGameXomlNames::MaxZoom_Hash)
	{
		if (delta)
			setMaxZoom(MaxZoom + data.GetAsFloat());
		else
			setMaxZoom(data.GetAsFloat());
	}
	else
	if (element_name == CIwGameXomlNames::Zoom_Hash)
	{
		if (delta)
			setZoom(Zoom + data.GetAsFloat());
		else
			setZoom(data.GetAsFloat());
	}
	else
		return false;

	return true;
}
Ejemplo n.º 2
0
bool CIwGameUITextView::UpdateBinding(unsigned int element_name, CIwGameXomlVariable* var)
{
	// Two way binding for Zoom (passes the value back to the variable)
	if (PrevZoom != Zoom)
	{
		if (element_name == CIwGameXomlNames::Zoom_Hash)
		{
			if (var->Type == VT_Float)
				var->setValue(CIwGameString(Zoom).c_str());	// Write Value back to bound variable
			else
			if (var->Type == VT_Int)
				var->setValue(CIwGameString((int)Zoom).c_str());	// Write Value back to bound variable
			return true;
		}
	}

	if (!var->Modified || var->getValue().IsEmpty())
		return false;
	if (CIwGameUILabel::UpdateBinding(element_name, var))
		return true;

	if (element_name == CIwGameXomlNames::Zoom_Hash)
	{
		if (var->Type == VT_Float)
			setZoom(((CIwGameXomlVariableFloat*)var)->NativeValue);
		else
		if (var->Type == VT_Int)
			setZoom((float)((CIwGameXomlVariableInt*)var)->NativeValue);
#if defined(_DEBUG)
		else
			CIwGameError::LogError("Warning: Incorrect binding variable type, expected float or int for Zoom");
#endif // _DEBUG
	}
	else
	if (element_name == CIwGameXomlNames::MinZoom_Hash)
	{
		if (var->Type == VT_Float)
			setMinZoom(((CIwGameXomlVariableFloat*)var)->NativeValue);
#if defined(_DEBUG)
		else
			CIwGameError::LogError("Warning: Incorrect binding variable type, expected float for MinZoom");
#endif // _DEBUG
	}
	else
	if (element_name == CIwGameXomlNames::MaxZoom_Hash)
	{
		if (var->Type == VT_Float)
			setMaxZoom(((CIwGameXomlVariableFloat*)var)->NativeValue);
#if defined(_DEBUG)
		else
			CIwGameError::LogError("Warning: Incorrect binding variable type, expected float for MaxZoom");
#endif // _DEBUG
	}
	else
		return false;

	return true;
}
Ejemplo n.º 3
0
/*!
 * Constructor
 */
ControlWidget::ControlWidget(QWidget *ipParent)
    : QWidget(ipParent)
{
    ui.setupUi(this);

    setMinZoom(0);
    setMaxZoom(10);
    setZoom(5);
}
Ejemplo n.º 4
0
void UIMinimap::onStyleApply(const std::string& styleName, const OTMLNodePtr& styleNode)
{
    UIWidget::onStyleApply(styleName, styleNode);
    for(const OTMLNodePtr& node : styleNode->children()) {
        if(node->tag() == "zoom")
            setZoom(node->value<int>());
        else if(node->tag() == "max-zoom")
            setMaxZoom(node->value<int>());
        else if(node->tag() == "min-zoom")
            setMinZoom(node->value<int>());
    }
}
Ejemplo n.º 5
0
NodeGraphDisplay::NodeGraphDisplay(ParentElement *parent_, APoint a_pos, AVec a_size, GuiStateFlags s_flags, NodeGraph *node_graph)
	: GuiElement(parent_, a_pos, a_size, GuiProps(s_flags, PROP_FLAGS)),
		NodeElementContainer(s_flags, APoint(-10000.0f, -10000.0f), APoint(10000.0f, 10000.0f), BASE_GRAPH_STEP, ZOOM_STEP),
		nodeGraph(node_graph)
{
	initGraph();

	setAllBgStateColors(Color(0.10f, 0.10f, 0.10f, 1.0f));

	setMinZoom(AVec(0.3f, 0.3f));
	setMaxZoom(AVec(3.0f, 3.0f));
	setMinViewOffset(APoint(-FLT_MAX, -FLT_MAX));
	setMaxViewOffset(APoint(FLT_MAX, FLT_MAX));
	
	setViewOffset(-size*(1.0f/2.0f));
	setZoomPivot(size*(1.0f/2.0f));
}
Ejemplo n.º 6
0
void GLFWView::toggle3DExtrusions(bool visible) {
    show3DExtrusions = visible;

    // Satellite-only style does not contain building extrusions data.
    if (!map->getStyle().getSource("composite")) {
        return;
    }

    if (auto layer = map->getStyle().getLayer("3d-buildings")) {
        layer->setVisibility(mbgl::style::VisibilityType(!show3DExtrusions));
        return;
    }

    auto extrusionLayer = std::make_unique<mbgl::style::FillExtrusionLayer>("3d-buildings", "composite");
    extrusionLayer->setSourceLayer("building");
    extrusionLayer->setMinZoom(15.0f);
    extrusionLayer->setFilter(mbgl::style::EqualsFilter { "extrude", { std::string("true") } });

    auto colorFn = mbgl::style::SourceFunction<mbgl::Color> { "height",
        mbgl::style::ExponentialStops<mbgl::Color> {
            std::map<float, mbgl::Color> {
                {   0.f, *mbgl::Color::parse("#160e23") },
                {  50.f, *mbgl::Color::parse("#00615f") },
                { 100.f, *mbgl::Color::parse("#55e9ff") }
            }
        }
    };
    extrusionLayer->setFillExtrusionColor({ colorFn });
    extrusionLayer->setFillExtrusionOpacity({ 0.6f });

    auto heightSourceFn = mbgl::style::SourceFunction<float> { "height", mbgl::style::IdentityStops<float>() };
    extrusionLayer->setFillExtrusionHeight({ heightSourceFn });

    auto baseSourceFn = mbgl::style::SourceFunction<float> { "min_height", mbgl::style::IdentityStops<float>() };
    extrusionLayer->setFillExtrusionBase({ baseSourceFn });

    map->getStyle().addLayer(std::move(extrusionLayer));
}
Ejemplo n.º 7
0
void ZoomSlider::setZoomLimits(double newMinZoom, double newMaxZoom){
    setMinZoom(newMinZoom);
    setMaxZoom(newMaxZoom);
}