Skip to content

Commit

Permalink
Prepared fix for issue #614.
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsschmidt1337 committed Dec 12, 2017
1 parent eb7664a commit 06e5133
Show file tree
Hide file tree
Showing 8 changed files with 199 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* MIT - License
Copyright (c) 2012 - this year, Nils Schmidt
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
package org.nschmidt.ldparteditor.data;

public class VM28SlantingMatrixProjector extends VM27YTruder {

protected VM28SlantingMatrixProjector(DatFile linkedDatFile) {
super(linkedDatFile);
}

public void projectWithSlantingMatrix() {
// FIXME Needs impl.
}

}
2 changes: 1 addition & 1 deletion src/org/nschmidt/ldparteditor/data/VM99Clipboard.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
import org.nschmidt.ldparteditor.text.DatParser;
import org.nschmidt.ldparteditor.text.StringHelper;

class VM99Clipboard extends VM27YTruder {
class VM99Clipboard extends VM28SlantingMatrixProjector {

private static final List<GData> CLIPBOARD = new ArrayList<GData>();
private static final Set<GData> CLIPBOARD_InvNext = Collections.newSetFromMap(new ThreadsafeHashMap<GData, Boolean>());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/* MIT - License
Copyright (c) 2012 - this year, Nils Schmidt
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
package org.nschmidt.ldparteditor.dialogs.slantingmatrixprojector;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.nschmidt.ldparteditor.i18n.I18n;

/**
* The SlantingMatrixProjector dialog
* <p>
* Note: This class should not be instantiated, it defines the gui layout and no
* business logic.
*
* @author nils
*
*/
class SlantingMatrixProjectorDesign extends Dialog {

// Use final only for subclass/listener references!

SlantingMatrixProjectorDesign(Shell parentShell) {
super(parentShell);
}

/**
* Create contents of the dialog.
*
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite cmp_container = (Composite) super.createDialogArea(parent);
GridLayout gridLayout = (GridLayout) cmp_container.getLayout();
gridLayout.verticalSpacing = 10;
gridLayout.horizontalSpacing = 10;

Label lbl_specify = new Label(cmp_container, SWT.NONE);
// TODO lbl_specify.setText(I18n.MATRIXPROJECTOR_Title);

Label lbl_separator = new Label(cmp_container, SWT.SEPARATOR | SWT.HORIZONTAL);
lbl_separator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));

Label lbl_info = new Label(cmp_container, SWT.NONE);
lbl_info.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
// TODO lbl_info.setText(I18n.MATRIXPROJECTOR_Hint);

cmp_container.pack();
return cmp_container;
}

/**
* Create contents of the button bar.
*
* @param parent
*/
@Override
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.OK_ID, I18n.DIALOG_OK, true);
createButton(parent, IDialogConstants.CANCEL_ID, I18n.DIALOG_Cancel, false);
}

/**
* Return the initial size of the dialog.
*/
@Override
protected Point getInitialSize() {
return super.getInitialSize();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* MIT - License
Copyright (c) 2012 - this year, Nils Schmidt
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
package org.nschmidt.ldparteditor.dialogs.slantingmatrixprojector;

import org.eclipse.swt.widgets.Shell;

/**
*
* <p>
* Note: This class should be instantiated, it defines all listeners and part of
* the business logic. It overrides the {@code open()} method to invoke the
* listener definitions ;)
*
* @author nils
*
*/
public class SlantingMatrixProjectorDialog extends SlantingMatrixProjectorDesign {

/**
* Create the dialog.
*
* @param parentShell
*/
public SlantingMatrixProjectorDialog(Shell parentShell) {
super(parentShell);
}

@Override
public int open() {
super.create();
// MARK All final listeners will be configured here..

return super.open();
}

}
2 changes: 2 additions & 0 deletions src/org/nschmidt/ldparteditor/i18n/Editor3D.properties
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@ SetXYZ = Set X/Y/Z (for Selection)
ShowAll = Show All
SlantingMatrixProjector = SlantingMatrixProjector
SlicerPro = SlicerPro
Smooth = Smooth Vertices
Expand Down
1 change: 1 addition & 0 deletions src/org/nschmidt/ldparteditor/i18n/I18n.java
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ private static void adjust() { // Calculate line offset
public static final String E3D_SetIconSize = E3D.getString(getProperty());
public static final String E3D_SetXYZ = E3D.getString(getProperty());
public static final String E3D_ShowAll = E3D.getString(getProperty());
public static final String E3D_SlantingMatrixProjector = E3D.getString(getProperty());
public static final String E3D_SlicerPro = E3D.getString(getProperty());
public static final String E3D_Smooth = E3D.getString(getProperty());
public static final String E3D_Snapping = E3D.getString(getProperty());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ class Editor3DDesign extends ApplicationWindow {
final MenuItem[] mntm_Isecalc = new MenuItem[1];
final MenuItem[] mntm_SlicerPro = new MenuItem[1];
final MenuItem[] mntm_Intersector = new MenuItem[1];
final MenuItem[] mntm_SlantingMatrixProjector = new MenuItem[1];
final MenuItem[] mntm_Lines2Pattern = new MenuItem[1];
final MenuItem[] mntm_PathTruder = new MenuItem[1];
final MenuItem[] mntm_YTruder = new MenuItem[1];
Expand Down Expand Up @@ -2563,6 +2564,11 @@ public void widgetSelected(SelectionEvent e) {
this.mntm_Intersector[0] = mntm_Intersector;
mntm_Intersector.setText(I18n.E3D_Intersector);
}
{
MenuItem mntm_MatrixCalculator = new MenuItem(mnu_Tools, SWT.PUSH);
this.mntm_SlantingMatrixProjector[0] = mntm_MatrixCalculator;
mntm_MatrixCalculator.setText(I18n.E3D_SlantingMatrixProjector);
}
{
MenuItem mntm_Lines2Pattern = new MenuItem(mnu_Tools, SWT.PUSH);
this.mntm_Lines2Pattern[0] = mntm_Lines2Pattern;
Expand Down
20 changes: 20 additions & 0 deletions src/org/nschmidt/ldparteditor/shells/editor3d/Editor3DWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
import org.nschmidt.ldparteditor.dialogs.scale.ScaleDialog;
import org.nschmidt.ldparteditor.dialogs.selectvertex.VertexDialog;
import org.nschmidt.ldparteditor.dialogs.setcoordinates.CoordinatesDialog;
import org.nschmidt.ldparteditor.dialogs.slantingmatrixprojector.SlantingMatrixProjectorDialog;
import org.nschmidt.ldparteditor.dialogs.slicerpro.SlicerProDialog;
import org.nschmidt.ldparteditor.dialogs.smooth.SmoothDialog;
import org.nschmidt.ldparteditor.dialogs.symsplitter.SymSplitterDialog;
Expand Down Expand Up @@ -4758,6 +4759,25 @@ public void widgetSelected(SelectionEvent e) {
}
});

mntm_SlantingMatrixProjector[0].addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
for (OpenGLRenderer renderer : renders) {
Composite3D c3d = renderer.getC3D();
if (c3d.getLockableDatFileReference().equals(Project.getFileToEdit()) && !c3d.getLockableDatFileReference().isReadOnly()) {
VertexManager vm = c3d.getLockableDatFileReference().getVertexManager();
if (new SlantingMatrixProjectorDialog(getShell()).open() == IDialogConstants.OK_ID) {
vm.addSnapshot();
vm.projectWithSlantingMatrix();
}
regainFocus();
return;
}
}
regainFocus();
}
});

mntm_Lines2Pattern[0].addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Expand Down

0 comments on commit 06e5133

Please sign in to comment.