mirror of
https://github.com/euphy/polargraphcontroller
synced 2024-11-13 01:47:57 +01:00
Added a couple of webcam bits.
This commit is contained in:
parent
0078031131
commit
3746f10240
@ -346,11 +346,99 @@ class DisplayMachine extends Machine
|
||||
}
|
||||
}
|
||||
|
||||
public void drawForWebcam()
|
||||
{
|
||||
// work out the scaling factor.
|
||||
noStroke();
|
||||
// draw machine outline
|
||||
|
||||
// fill(80);
|
||||
// rect(getOutline().getLeft()+DROP_SHADOW_DISTANCE, getOutline().getTop()+DROP_SHADOW_DISTANCE, getOutline().getWidth(), getOutline().getHeight());
|
||||
|
||||
fill(getMachineColour());
|
||||
rect(getOutline().getLeft(), getOutline().getTop(), getOutline().getWidth(), getOutline().getHeight());
|
||||
|
||||
|
||||
|
||||
// if (displayingGuides)
|
||||
// {
|
||||
// // draw some guides
|
||||
// stroke(getGuideColour());
|
||||
// strokeWeight(1);
|
||||
// // centre line
|
||||
// line(getOutline().getLeft()+(getOutline().getWidth()/2), getOutline().getTop(),
|
||||
// getOutline().getLeft()+(getOutline().getWidth()/2), getOutline().getBottom());
|
||||
//
|
||||
// // page top line
|
||||
// line(getOutline().getLeft(), getOutline().getTop()+sc(getHomePoint().y),
|
||||
// getOutline().getRight(), getOutline().getTop()+sc(getHomePoint().y));
|
||||
// }
|
||||
|
||||
// draw page
|
||||
fill(getPageColour());
|
||||
rect(getOutline().getLeft()+sc(getPage().getLeft()),
|
||||
getOutline().getTop()+sc(getPage().getTop()),
|
||||
sc(getPage().getWidth()),
|
||||
sc(getPage().getHeight()));
|
||||
text("page " + getDimensionsAsText(getPage()), getOutline().getLeft()+sc(getPage().getLeft()),
|
||||
getOutline().getTop()+sc(getPage().getTop())-3);
|
||||
noFill();
|
||||
|
||||
|
||||
|
||||
stroke(getBackgroundColour(),150);
|
||||
strokeWeight(3);
|
||||
noFill();
|
||||
rect(getOutline().getLeft()-2, getOutline().getTop()-2, getOutline().getWidth()+3, getOutline().getHeight()+3);
|
||||
|
||||
stroke(getMachineColour(),150);
|
||||
strokeWeight(3);
|
||||
noFill();
|
||||
rect(getOutline().getLeft()+sc(getPage().getLeft())-2,
|
||||
getOutline().getTop()+sc(getPage().getTop())-2,
|
||||
sc(getPage().getWidth())+4,
|
||||
sc(getPage().getHeight())+4);
|
||||
|
||||
if (displayingGuides)
|
||||
{
|
||||
drawPictureFrame();
|
||||
}
|
||||
|
||||
if (drawingLiveVideo)
|
||||
{
|
||||
drawLiveVideo();
|
||||
}
|
||||
|
||||
if (displayingVector && getVectorShape() != null)
|
||||
{
|
||||
stroke(100);
|
||||
displayVectorImage(color(200));
|
||||
}
|
||||
|
||||
if (displayingGuides
|
||||
&& getOutline().surrounds(getMouseVector())
|
||||
&& currentMode != MODE_MOVE_IMAGE
|
||||
&& mouseOverControls().isEmpty()
|
||||
)
|
||||
{
|
||||
cursor(CROSS);
|
||||
}
|
||||
else
|
||||
{
|
||||
cursor(ARROW);
|
||||
}
|
||||
}
|
||||
|
||||
public void displayVectorImage()
|
||||
{
|
||||
displayVectorImage(color(0,0,0));
|
||||
}
|
||||
|
||||
public void displayVectorImage(int strokeColour)
|
||||
{
|
||||
RPoint[][] pointPaths = getVectorShape().getPointsInPaths();
|
||||
RG.ignoreStyles();
|
||||
stroke(1);
|
||||
strokeWeight(1);
|
||||
if (pointPaths != null)
|
||||
{
|
||||
for(int i = 0; i<pointPaths.length; i++)
|
||||
@ -366,7 +454,7 @@ class DisplayMachine extends Machine
|
||||
if (getPage().surrounds(inSteps(p)))
|
||||
{
|
||||
p = scaleToScreen(p);
|
||||
stroke(0);
|
||||
stroke(strokeColour);
|
||||
vertex(p.x, p.y);
|
||||
//ellipse(p.x, p.y, 3, 3);
|
||||
}
|
||||
|
@ -130,6 +130,16 @@ Map<String, Panel> buildPanels()
|
||||
rovingPanel.setControlSizes(buildControlSizesForPanel(rovingPanel));
|
||||
panels.put(PANEL_NAME_ROVING, rovingPanel);
|
||||
|
||||
Panel webcamPanel = new Panel(PANEL_NAME_WEBCAM, panelOutline);
|
||||
webcamPanel.setOutlineColour(color(200,200,200));
|
||||
// get controls
|
||||
webcamPanel.setResizable(true);
|
||||
webcamPanel.setControls(getControlsForPanels().get(PANEL_NAME_WEBCAM));
|
||||
// get control positions
|
||||
rovingPanel.setControlPositions(buildControlPositionsForPanel(webcamPanel));
|
||||
rovingPanel.setControlSizes(buildControlSizesForPanel(webcamPanel));
|
||||
panels.put(PANEL_NAME_WEBCAM, webcamPanel);
|
||||
|
||||
Panel detailsPanel = new Panel(PANEL_NAME_DETAILS, panelOutline);
|
||||
detailsPanel.setOutlineColour(color(200, 200, 200));
|
||||
// get controls
|
||||
|
@ -1,3 +1,8 @@
|
||||
import JMyron.*;
|
||||
import diewald_CV_kit.libraryinfo.*;
|
||||
import diewald_CV_kit.utility.*;
|
||||
import diewald_CV_kit.blobdetection.*;
|
||||
|
||||
import geomerative.*;
|
||||
import org.apache.batik.svggen.font.table.*;
|
||||
import org.apache.batik.svggen.font.*;
|
||||
@ -383,6 +388,8 @@ public static final String TAB_NAME_DETAILS = "tab_details";
|
||||
public static final String TAB_LABEL_DETAILS = "Setup";
|
||||
public static final String TAB_NAME_QUEUE = "tab_queue";
|
||||
public static final String TAB_LABEL_QUEUE = "Queue";
|
||||
public static final String TAB_NAME_WEBCAM = "tab_webcam";
|
||||
public static final String TAB_LABEL_WEBCAM = "Camera";
|
||||
|
||||
// Page states
|
||||
public String currentTab = TAB_NAME_INPUT;
|
||||
@ -392,6 +399,7 @@ public static final String PANEL_NAME_INPUT = "panel_input";
|
||||
public static final String PANEL_NAME_ROVING = "panel_roving";
|
||||
public static final String PANEL_NAME_DETAILS = "panel_details";
|
||||
public static final String PANEL_NAME_QUEUE = "panel_queue";
|
||||
public static final String PANEL_NAME_WEBCAM = "panel_webcam";
|
||||
|
||||
public static final String PANEL_NAME_GENERAL = "panel_general";
|
||||
|
||||
@ -565,6 +573,10 @@ void draw()
|
||||
{
|
||||
drawRovingPage();
|
||||
}
|
||||
else if (getCurrentTab() == TAB_NAME_WEBCAM)
|
||||
{
|
||||
drawWebcamPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
drawDetailsPage();
|
||||
@ -740,6 +752,34 @@ void drawRovingPage()
|
||||
showCommandQueue((int) getDisplayMachine().getOutline().getRight()+6, 20);
|
||||
}
|
||||
|
||||
void drawWebcamPage()
|
||||
{
|
||||
strokeWeight(1);
|
||||
background(100);
|
||||
noFill();
|
||||
stroke(255, 150, 255, 100);
|
||||
strokeWeight(3);
|
||||
stroke(150);
|
||||
noFill();
|
||||
getDisplayMachine().drawForWebcam();
|
||||
stroke(255, 0, 0);
|
||||
|
||||
for (Panel panel : getPanelsForTab(TAB_NAME_WEBCAM))
|
||||
{
|
||||
panel.draw();
|
||||
}
|
||||
text(propertiesFilename, getPanel(PANEL_NAME_GENERAL).getOutline().getLeft(), getPanel(PANEL_NAME_GENERAL).getOutline().getTop()-7);
|
||||
|
||||
// showCurrentMachinePosition();
|
||||
showGroupBox();
|
||||
showCurrentMachinePosition();
|
||||
if (displayingInfoTextOnInputPage)
|
||||
showText(250,45);
|
||||
drawStatusText((int)statusTextPosition.x, (int)statusTextPosition.y);
|
||||
|
||||
showCommandQueue((int) getDisplayMachine().getOutline().getRight()+6, 20);
|
||||
}
|
||||
|
||||
void drawCommandQueuePage()
|
||||
{
|
||||
cursor(ARROW);
|
||||
|
13
tabSetup.pde
13
tabSetup.pde
@ -49,6 +49,10 @@ Map<String, Set<Panel>> buildPanelsForTabs()
|
||||
rovingPanels.add(getPanel(PANEL_NAME_ROVING));
|
||||
rovingPanels.add(getPanel(PANEL_NAME_GENERAL));
|
||||
|
||||
Set<Panel> webcamPanels = new HashSet<Panel>(2);
|
||||
webcamPanels.add(getPanel(PANEL_NAME_WEBCAM));
|
||||
webcamPanels.add(getPanel(PANEL_NAME_WEBCAM));
|
||||
|
||||
Set<Panel> detailsPanels = new HashSet<Panel>(2);
|
||||
detailsPanels.add(getPanel(PANEL_NAME_DETAILS));
|
||||
detailsPanels.add(getPanel(PANEL_NAME_GENERAL));
|
||||
@ -59,6 +63,7 @@ Map<String, Set<Panel>> buildPanelsForTabs()
|
||||
|
||||
map.put(TAB_NAME_INPUT, inputPanels);
|
||||
map.put(TAB_NAME_ROVING, rovingPanels);
|
||||
map.put(TAB_NAME_WEBCAM, webcamPanels);
|
||||
map.put(TAB_NAME_DETAILS, detailsPanels);
|
||||
map.put(TAB_NAME_QUEUE, queuePanels);
|
||||
|
||||
@ -70,6 +75,7 @@ List<String> buildTabNames()
|
||||
List<String> list = new ArrayList<String>(4);
|
||||
list.add(TAB_NAME_INPUT);
|
||||
list.add(TAB_NAME_ROVING);
|
||||
list.add(TAB_NAME_WEBCAM);
|
||||
list.add(TAB_NAME_DETAILS);
|
||||
list.add(TAB_NAME_QUEUE);
|
||||
return list;
|
||||
@ -89,9 +95,13 @@ void initTabs()
|
||||
cp5.tab(TAB_NAME_ROVING).activateEvent(true);
|
||||
cp5.tab(TAB_NAME_ROVING).setId(3);
|
||||
|
||||
cp5.tab(TAB_NAME_WEBCAM).setLabel(TAB_LABEL_WEBCAM);
|
||||
cp5.tab(TAB_NAME_WEBCAM).activateEvent(true);
|
||||
cp5.tab(TAB_NAME_WEBCAM).setId(4);
|
||||
|
||||
cp5.tab(TAB_NAME_QUEUE).setLabel(TAB_LABEL_QUEUE);
|
||||
cp5.tab(TAB_NAME_QUEUE).activateEvent(true);
|
||||
cp5.tab(TAB_NAME_QUEUE).setId(4);
|
||||
cp5.tab(TAB_NAME_QUEUE).setId(5);
|
||||
}
|
||||
|
||||
public Set<String> buildPanelNames()
|
||||
@ -99,6 +109,7 @@ public Set<String> buildPanelNames()
|
||||
Set<String> set = new HashSet<String>(5);
|
||||
set.add(PANEL_NAME_INPUT);
|
||||
set.add(PANEL_NAME_ROVING);
|
||||
set.add(PANEL_NAME_WEBCAM);
|
||||
set.add(PANEL_NAME_DETAILS);
|
||||
set.add(PANEL_NAME_QUEUE);
|
||||
set.add(PANEL_NAME_GENERAL);
|
||||
|
Loading…
Reference in New Issue
Block a user