void DrawLineAndAreaTool::setDrawingSymbol(const Symbol* symbol) { // Avoid using deleted symbol if (map()->findSymbolIndex(drawing_symbol) == -1) symbol = NULL; // End current editing if (editingInProgress()) { if (symbol) finishDrawing(); else abortDrawing(); } // Handle new symbol if (!is_helper_tool) drawing_symbol = symbol; if (!symbol) deactivate(); else if (symbol->isHidden()) deactivate(); else if ((symbol->getType() & (Symbol::Line | Symbol::Area | Symbol::Combined)) == 0) switchToDefaultDrawTool(symbol); else createPreviewPoints(); }
void DrawTextTool::setDrawingSymbol(const Symbol* symbol) { // Avoid using deleted symbol if (map()->findSymbolIndex(drawing_symbol) == -1) symbol = NULL; // End current editing if (text_editor) { if (symbol) finishEditing(); else abortEditing(); } // Handle new symbol drawing_symbol = symbol; deletePreviewText(); if (!symbol) deactivate(); else if (symbol->isHidden()) deactivate(); else if (symbol->getType() != Symbol::Text) switchToDefaultDrawTool(symbol); }
void DrawPointTool::activeSymbolChanged(const Symbol* symbol) { if (!symbol) switchToDefaultDrawTool(nullptr); else if (symbol->isHidden()) deactivate(); else if (symbol->getType() != Symbol::Point) switchToDefaultDrawTool(symbol); else if (preview_object) { renderables->removeRenderablesOfObject(preview_object.get(), false); preview_object->setRotation(0); preview_object->setSymbol(symbol, true); // Let update happen on later event. } }
void DrawPointTool::activeSymbolChanged(const Symbol* symbol) { if (symbol == NULL || symbol->getType() != Symbol::Point || symbol->isHidden()) { if (symbol && symbol->isHidden()) deactivate(); else switchToDefaultDrawTool(symbol); } else last_used_symbol = symbol; }