MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / turnViewToProjGroup

Method turnViewToProjGroup

src/Mod/TechDraw/Gui/TaskProjGroup.cpp:306–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

304
305
306void TaskProjGroup::turnViewToProjGroup()
307{
308 App::Document* doc = view->getDocument();
309
310 std::string multiViewName = doc->getUniqueObjectName("ProjGroup");
311 Gui::Command::doCommand(Gui::Command::Gui, "App.activeDocument().addObject('TechDraw::DrawProjGroup', '%s')", multiViewName.c_str());
312 Gui::Command::doCommand(Gui::Command::Gui, "App.activeDocument().%s.addView(App.activeDocument().%s)", view->findParentPage()->getNameInDocument(), multiViewName.c_str());
313
314 auto* viewPart = static_cast<TechDraw::DrawViewPart*>(view);
315
316 multiView = static_cast<TechDraw::DrawProjGroup*>(doc->getObject(multiViewName.c_str()));
317 multiView->Source.setValues(viewPart->Source.getValues());
318 multiView->XSource.setValues(viewPart->XSource.getValues());
319 multiView->X.setValue(viewPart->X.getValue());
320 multiView->Y.setValue(viewPart->Y.getValue());
321 multiView->Scale.setValue(viewPart->Scale.getValue());
322 multiView->ScaleType.setValue(viewPart->ScaleType.getValue());
323 multiView->ProjectionType.setValue(Preferences::projectionAngle());
324
325 multiView->addView(viewPart);
326 multiView->Anchor.setValue(viewPart);
327 multiView->Anchor.purgeTouched();
328 multiView->AutoDistribute.setValue(ui->cbAutoDistribute->isChecked());
329
330 viewPart->X.setValue(0.0);
331 viewPart->Y.setValue(0.0);
332 viewPart->ScaleType.setValue("Custom");
333 viewPart->ScaleType.setStatus(App::Property::Hidden, true);
334 viewPart->Scale.setStatus(App::Property::Hidden, true);
335 viewPart->Label.setValue("Front");
336 viewPart->LockPosition.setValue(true);
337 viewPart->LockPosition.setStatus(App::Property::ReadOnly, true); //Front should stay locked.
338 viewPart->LockPosition.purgeTouched();
339
340 m_page->requestPaint();
341 view = multiView;
342 m_page->removeView(viewPart); // prevent multiple entries in tree
343
344 updateUi();
345}
346
347void TaskProjGroup::turnProjGroupToView()
348{

Callers

nothing calls this directly

Calls 15

getDocumentMethod · 0.45
getUniqueObjectNameMethod · 0.45
c_strMethod · 0.45
getNameInDocumentMethod · 0.45
findParentPageMethod · 0.45
getObjectMethod · 0.45
setValuesMethod · 0.45
getValuesMethod · 0.45
setValueMethod · 0.45
getValueMethod · 0.45
addViewMethod · 0.45
purgeTouchedMethod · 0.45

Tested by

no test coverage detected