-
Notifications
You must be signed in to change notification settings - Fork 2
/
LinkageDesign.m
97 lines (75 loc) · 2.27 KB
/
LinkageDesign.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
function LinkageDesign
close all;
myGui = gui.autogui('Location','float');
myGui.PanelWidth=200;
propsP = {'LineStyle','none','Marker','o','MarkerEdge','black','MarkerFaceColor','red','MarkerSize',6};
set(gcf,'Renderer','OpenGL');
warning('off','MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame');
jFrame = get(handle(myGui.UiHandle),'JavaFrame'); drawnow;
jFrame_fHGxClient = jFrame.fHG2Client;
jFrame_fHGxClient.getWindow.setAlwaysOnTop(true);
axesopt={};
hFig = figure('WindowKeyPressFcn',@OnKeyPress);
MainAxes=axes('ButtonDownFcn',@OnLeftAxesDown); axis equal;
axis([-2,2,-2,2]);
linkage=Linkage(propsP{:});
addlistener(linkage,'PointPicked',@OnPPicked);
addlistener(linkage,'PointDropped',@OnPDropped);
addlistener(linkage,'PointDragged',@OnPointDrag);
addlistener(linkage,'PointRemoved',@OnPointRemoved);
%% Global variables
axes(MainAxes);
hold on
clickflag = false;
% Parameterizer=AutoCutsParameterizer;
% hLis=addlistener(Parameterizer,'IterationDone',@OnSolverIter);
active=false;
%% GUI initialization
BtnLoadSource = gui.pushbutton('Load Mesh');
BtnLoadSource.ValueChangedFcn = @OnButtonLoadMesh;
%% Callbacks
function OnButtonLoadMesh(~)
end
function OnInitialize(~)
Parameterizer.Initialize;
EditMaxDist.Value = inf;
end
function OnPPicked(src,evt)
end
function OnPointDrag(~,~)
end
function OnPDropped(src,evt)
end
function OnPointRemoved(~,~)
end
function OnLeftAxesDown(src,evtdata)
modifier = get(gcf,'SelectionType');
pos=get(gca,'currentpoint'); pos=pos(1,1:2)';
switch modifier
case 'alt' % in windows this is 'control'
fi=linkage.AddPoint(pos);
otherwise
return;
end
end
function OnKeyPress(src,evtdata)
switch evtdata.Character
case 's'
if active==false
active=true;
Parameterizer.StartInteractiveDeform;
else
active=false;
Parameterizer.StopInteractiveDeform;
end
end
end
function OnSolverIter(src,evtdata)
Redraw;
end
%% Helper Functions
%% Drawing functions
function Redraw(~)
drawnow;
end
end