void TileModel::AddLocationLayer(LocationLayerPtr location) { // Update number of locations in Tile numLocations++; // Add sequence layers to tile? std::vector<SequenceLayerPtr> sequences = location->GetAllSequenceLayers(); UpdateSequences(sequences); // Add fields to tile UpdateData(location->GetLocationController()->GetData()); }
bool LocationPolygons::SortByColour(LocationLayerPtr p1, LocationLayerPtr p2) { Colour p1Colour = p1->GetLocationController()->GetColour(); Colour p2Colour = p2->GetLocationController()->GetColour(); //Arbitrary weighted average to make sure the same colours are grouped together double p1Average = (2027*p1Colour.GetRed() + 2063*p1Colour.GetGreen() + 2067*p1Colour.GetBlue())/3; double p2Average = (2027*p2Colour.GetRed() + 2063*p2Colour.GetGreen() + 2067*p2Colour.GetBlue())/3; return (p1Average < p2Average); }
bool LocationSetLayer::RemoveLayer(uint id) { bool bFound = false; for(unsigned int index = 0; index < GetNumLocationLayers() && !bFound; index++) { LocationLayerPtr layer = GetLocationLayer(index); if(layer->GetId() == id) { RemoveLocationLayerByIndex(index); return true; } bFound = layer->RemoveLayer(id); } return bFound; }
LayerPtr LocationSetLayer::GetLayer(uint id) const { for(unsigned int index = 0; index < GetNumLocationLayers(); index++) { LocationLayerPtr layer = GetLocationLayer(index); if(layer->GetId() == id) return layer; LayerPtr returnLayer = layer->GetLayer(id); if(returnLayer != LayerPtr()) { return returnLayer; } } return LayerPtr(); }
void LocationView::ShowPropertiesDlg() { LocationLayerPtr locationLayer; for (uint i = 0; i < App::Inst().GetLayerTreeController()->GetNumLocationLayers(); i++) { locationLayer = App::Inst().GetLayerTreeController()->GetLocationLayer(i); if (locationLayer->GetId() == m_locationLayerId) break; } if ( locationLayer->HasPropertiesDialogOpen() ) { locationLayer->GetPropertiesDialog()->SetFocus(); locationLayer->GetPropertiesDialog()->Raise(); } else { LocationPropertiesDlg* dlg = new LocationPropertiesDlg(App::Inst().GetMainWindow(), locationLayer); dlg->SetPage(LocationPropertiesDlg::SYMBOLOGY); dlg->Show(); dlg->SetFocus(); dlg->Raise(); locationLayer->SetPropertiesDialogOpenStatus( true ); } }
foreach(LocationLayerPtr locationLayer, m_locationLayers) { if(locationLayer->GetNumSequenceLayers() > 0) return true; }