Ejemplo n.º 1
0
NodeGeoTree* LocationView::GetTreeNode(const std::wstring& id)
{
	LayerTreeControllerPtr layerTreeCtrl = App::Inst().GetLayerTreeController();

	for(uint i = 0; i < layerTreeCtrl->GetNumTreeLayers(); ++i)
	{
		TreeLayerPtr treeLayer = layerTreeCtrl->GetTreeLayer(i);
		GeoTreeViewPtr geoTreeView = treeLayer->GetGeoTreeView(); 

		NodeGeoTree* node = geoTreeView->GetNode(id);
		if(node)
			return node;
	}

	return NULL;
}
Ejemplo n.º 2
0
void LocationPropertiesDlg::ApplySymbology()
{
	LocationViewPtr locationView = m_locationLayer->GetLocationController()->GetLocationView();

	// set properties based on state of controls in Symbology page
	Colour colour = Colour(m_colourSymbol->GetColour());
	if(colour != locationView->GetColour())
	{
		locationView->SetColour(colour);
		locationView->SetColourModified(true);
	}

	if(locationView->GetSize() != StringTools::ToDouble(m_txtSymbolSize->GetValue().c_str()))
	{
		locationView->SetSize(StringTools::ToDouble(m_txtSymbolSize->GetValue().c_str()));
		locationView->SetSizeModified(true);
	}
	
	VisualMarker::MARKER_SHAPE shape;
	if(m_cboSymbolShape->GetValue() == _T("Circle"))
		shape = VisualMarker::CIRCLE;
	else if(m_cboSymbolShape->GetValue() == _T("Circle (fast)"))
		shape = VisualMarker::CIRCLE_FAST;
	else if(m_cboSymbolShape->GetValue() == _T("Square"))
		shape = VisualMarker::SQUARE;
	else if(m_cboSymbolShape->GetValue() == _T("Triangle"))
		shape = VisualMarker::TRIANGLE;
	else if(m_cboSymbolShape->GetValue() == _T("Star"))
		shape = VisualMarker::STAR;
	else if(m_cboSymbolShape->GetValue() == _T("Plus sign"))
		shape = VisualMarker::PLUS_SIGN;
	else if(m_cboSymbolShape->GetValue() == _T("Octagon"))
		shape = VisualMarker::OCTAGON;
	else if(m_cboSymbolShape->GetValue() == _T("Diamond"))
		shape = VisualMarker::DIAMOND;
	else if(m_cboSymbolShape->GetValue() == _T("Inverted triangle"))
		shape = VisualMarker::INVERTED_TRIANGLE;

	if(locationView->GetShape() != shape)
	{
		locationView->SetShape(shape);
		locationView->SetShapeModified(true);
	}

	if(locationView->IsVisible() != m_chkLocationVisible->GetValue())
	{
		//Set Visibility
		locationView->SetVisibility(m_chkLocationVisible->GetValue());

		//Set the checkbox in the layer tree
		wxTreeItemId treeItem = m_locationLayer->GetWXTreeItemId();
		LayerTreeViewPtr treeView = App::Inst().GetLayerTreeController()->GetTreeView();
		treeView->SetChecked(treeItem, m_chkLocationVisible->GetValue());

		//Redraw polygons
		std::vector<LocationSetLayerPtr> locationSets = App::Inst().GetLayerTreeController()->GetLocationSetLayers();
		for(uint i = 0; i < locationSets.size(); i++)
			locationSets[i]->GetLocationPolygons()->SetPolygonsChanged(true);

		//Update tree
		LayerTreeControllerPtr layerTreeController = App::Inst().GetLayerTreeController();
		for (uint i = 0; i < layerTreeController->GetNumTreeLayers(); i++)
		{
			//alexk Don't ask me why you have to do this in such a roundabout way, but otherwise Mac cries.
			GeoTreeViewPtr geoTree = layerTreeController->GetTreeLayer(i)->GetGeoTreeView();
			std::vector<GenGIS::LocationLayerPtr, std::allocator<GenGIS::LocationLayerPtr> > temp = App::Inst().GetLayerTreeController()->GetLocationLayers();
			geoTree->ProjectToActiveSet(temp);
			
	//		layerTreeController->GetTreeLayer(i)->GetGeoTreeView()->ProjectToActiveSet(layerTreeController->GetLocationLayers());
		}
	}

	// set label properties
	VisualLabelPtr label = locationView->GetLabel();
	if(label->GetSize() != m_spinLabelSize->GetValue())
	{
		label->SetSize(m_spinLabelSize->GetValue());
		locationView->SetLabelSizeModified(true);
	}

	if(label->GetLabelPosition() != m_cboLabelPosition->GetValue().c_str())
	{
		label->SetLabelPosition(m_cboLabelPosition->GetValue().c_str());
		locationView->SetLabelPositionModified(true);
	}

	if(label->GetLabelStyle() != m_cboLabelStyle->GetValue().c_str())
	{
		label->SetLabelStyle(m_cboLabelStyle->GetValue().c_str());
		locationView->SetLabelStyleModified(true);
	}

	colour = Colour(m_colourLabel->GetColour());
	if(label->GetColour() != colour)
	{
		label->SetColour(colour);
		locationView->SetLabelColourModified(true);
	}

	if(label->IsVisible() != m_chkLabelVisible->GetValue())
	{
		label->SetVisibility(m_chkLabelVisible->GetValue());
		locationView->SetLabelVisibilityModified(true);
	}

	locationView->SetLabel(label);

	((GenGisFrame*)App::Inst().GetMainWindow())->FillSamplesLegend(); 

	App::Inst().GetViewport()->Refresh(false);
}