| /******************************************************************************* |
| * Copyright (c) 2018 Agence spatiale canadienne / Canadian Space Agency |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Pierre Allard, |
| * Regent L'Archeveque, |
| * Olivier L. Larouche - initial API and implementation |
| * |
| * SPDX-License-Identifier: EPL-1.0 |
| *******************************************************************************/ |
| package org.eclipse.apogy.core.topology.ui.impl; |
| |
| import javax.vecmath.Matrix3d; |
| |
| import org.eclipse.apogy.common.emf.ui.EClassSettings; |
| import org.eclipse.apogy.common.emf.ui.MapBasedEClassSettings; |
| import org.eclipse.apogy.common.math.ApogyCommonMathFacade; |
| import org.eclipse.apogy.common.math.GeometricUtils; |
| import org.eclipse.apogy.common.topology.ApogyCommonTopologyFactory; |
| import org.eclipse.apogy.common.topology.AttachedViewPoint; |
| import org.eclipse.apogy.core.topology.ui.wizards.AttachedViewPointWizardPage; |
| import org.eclipse.emf.common.util.BasicEList; |
| import org.eclipse.emf.common.util.EList; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.jface.wizard.WizardPage; |
| |
| public class AttachedViewPointPagesProviderCustomImpl extends AttachedViewPointPagesProviderImpl { |
| |
| @Override |
| public EObject createEObject(EClass eClass, EClassSettings settings) { |
| AttachedViewPoint attachedViewPoint = ApogyCommonTopologyFactory.eINSTANCE.createAttachedViewPoint(); |
| attachedViewPoint.setPosition(ApogyCommonMathFacade.INSTANCE.createTuple3d(0, 0, 0)); |
| attachedViewPoint.setAllowRotation(true); |
| |
| Matrix3d rotationMatrix = GeometricUtils.packXYZ(Math.toRadians(90), Math.toRadians(90), 0); |
| attachedViewPoint.setRotationMatrix(ApogyCommonMathFacade.INSTANCE.createMatrix3x3(rotationMatrix)); |
| |
| if (settings instanceof MapBasedEClassSettings) { |
| MapBasedEClassSettings mapBasedEClassSettings = (MapBasedEClassSettings) settings; |
| attachedViewPoint.setName((String) mapBasedEClassSettings.getUserDataMap().get("name")); |
| } |
| |
| return attachedViewPoint; |
| } |
| |
| @Override |
| public EList<WizardPage> instantiateWizardPages(EObject eObject, EClassSettings settings) { |
| EList<WizardPage> list = new BasicEList<>(); |
| list.addAll(super.instantiateWizardPages(eObject, settings)); |
| |
| list.add(new AttachedViewPointWizardPage((AttachedViewPoint) eObject)); |
| |
| return list; |
| } |
| } // AttachedViewPointPagesProviderImpl |