Newer
Older
* Copyright (C) 2012 Thomas Oster <thomas.oster@rwth-aachen.de>
* RWTH Aachen University - 52062 Aachen, Germany
*
* VisiCut is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* VisiCut is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with VisiCut. If not, see <http://www.gnu.org/licenses/>.
**/
package com.t_oster.liblasercut;
/**
* The LaserProperty holds all the parameters for parts of the LaserJob.
* The Frequency value is ignored for Engraving operations
*
* @author oster
*/
public class PowerSpeedFocusFrequencyProperty extends PowerSpeedFocusProperty
{
private int frequency = 5000;
public PowerSpeedFocusFrequencyProperty()
{
}
public void setFrequency(int frequency)
{
frequency = frequency < 10 ? 10 : frequency;
frequency = frequency > 5000 ? 5000 : frequency;
this.frequency = frequency;
}
public int getFrequency()
{
return frequency;
}
private static String[] propertyNames = new String[]{"power", "speed", "focus", "frequency"};
@Override
Thomas Oster
committed
public String[] getPropertyKeys()
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
{
return propertyNames;
}
@Override
public Object getProperty(String name)
{
if ("frequency".equals(name))
{
return this.getFrequency();
}
else
{
return super.getProperty(name);
}
}
@Override
public void setProperty(String name, Object value)
{
if ("frequency".equals(name))
{
this.setFrequency((Integer) value);
}
else
{
super.setProperty(name, value);
}
}
@Override
public Object getMinimumValue(String name)
{
if ("frequency".equals(name))
{
return (Integer) 100;
}
else
{
return super.getMinimumValue(name);
}
}
@Override
public Object getMaximumValue(String name)
{
if ("frequency".equals(name))
{
return (Integer) 5000;
}
else
{
return super.getMaximumValue(name);
}
}
@Override
public Object[] getPossibleValues(String name)
{
if ("frequency".equals(name))
{
return null;
}
else
{
return super.getPossibleValues(name);
}
}
@Override
public PowerSpeedFocusFrequencyProperty clone()
{
PowerSpeedFocusFrequencyProperty p = new PowerSpeedFocusFrequencyProperty();
p.frequency = this.frequency;
p.setPower(getPower());
p.setSpeed(getSpeed());
p.setFocus(getFocus());
return p;