added predefined obstacles (no need for external images)
This commit is contained in:
parent
3675479274
commit
f577b17ab3
2 changed files with 87 additions and 82 deletions
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: FormulaViewer.java,v 1.2 2007/03/23 21:13:43 fros4943 Exp $
|
||||
* $Id: FormulaViewer.java,v 1.3 2008/02/18 08:21:59 fros4943 Exp $
|
||||
*/
|
||||
|
||||
package se.sics.mrm;
|
||||
|
@ -336,11 +336,12 @@ public class FormulaViewer extends se.sics.cooja.VisPlugin {
|
|||
JCheckBox collapseCheckBox = new JCheckBox("show settings", false);
|
||||
collapseCheckBox.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (((JCheckBox) e.getSource()).isSelected())
|
||||
if (((JCheckBox) e.getSource()).isSelected()) {
|
||||
collapsableArea.setVisible(true);
|
||||
else
|
||||
} else {
|
||||
collapsableArea.setVisible(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
collapsableArea.putClientProperty("my_checkbox", collapseCheckBox);
|
||||
|
||||
|
@ -511,21 +512,21 @@ public class FormulaViewer extends se.sics.cooja.VisPlugin {
|
|||
public void update(Observable obs, Object obj) {
|
||||
// Update all integers
|
||||
for (int i=0; i < allIntegerParameters.size(); i++) {
|
||||
JFormattedTextField textField = (JFormattedTextField) allIntegerParameters.get(i);
|
||||
JFormattedTextField textField = allIntegerParameters.get(i);
|
||||
String id = (String) textField.getClientProperty("id");
|
||||
textField.setValue(currentChannelModel.getParameterValue(id));
|
||||
}
|
||||
|
||||
// Update all doubles
|
||||
for (int i=0; i < allDoubleParameters.size(); i++) {
|
||||
JFormattedTextField textField = (JFormattedTextField) allDoubleParameters.get(i);
|
||||
JFormattedTextField textField = allDoubleParameters.get(i);
|
||||
String id = (String) textField.getClientProperty("id");
|
||||
textField.setValue(currentChannelModel.getParameterValue(id));
|
||||
}
|
||||
|
||||
// Update all booleans
|
||||
for (int i=0; i < allBooleanParameters.size(); i++) {
|
||||
JCheckBox checkBox = (JCheckBox) allBooleanParameters.get(i);
|
||||
JCheckBox checkBox = allBooleanParameters.get(i);
|
||||
String id = (String) checkBox.getClientProperty("id");
|
||||
checkBox.setSelected(currentChannelModel.getParameterBooleanValue(id));
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: MRM.java,v 1.5 2007/03/23 21:22:37 fros4943 Exp $
|
||||
* $Id: MRM.java,v 1.6 2008/02/18 08:21:59 fros4943 Exp $
|
||||
*/
|
||||
|
||||
package se.sics.mrm;
|
||||
|
@ -91,10 +91,12 @@ public class MRM extends AbstractRadioMedium {
|
|||
// Loop through all radios
|
||||
for (Radio listeningRadio: getRegisteredRadios()) {
|
||||
// Ignore sending radio and radios on different channels
|
||||
if (sendingRadio == listeningRadio)
|
||||
if (sendingRadio == listeningRadio) {
|
||||
continue;
|
||||
if (sendingRadio.getChannel() != listeningRadio.getChannel())
|
||||
}
|
||||
if (sendingRadio.getChannel() != listeningRadio.getChannel()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
double listeningPositionX = listeningRadio.getPosition().getXCoordinate();
|
||||
double listeningPositionY = listeningRadio.getPosition().getYCoordinate();
|
||||
|
@ -188,17 +190,19 @@ public class MRM extends AbstractRadioMedium {
|
|||
// ((MRMRadioConnection) conn).getSource().setCurrentSignalStrength(12345); // TODO Set signal strength on source?
|
||||
for (Radio dstRadio : ((MRMRadioConnection) conn).getDestinations()) {
|
||||
double signalStrength = ((MRMRadioConnection) conn).getDestinationSignalStrength(dstRadio);
|
||||
if (signalStrength > dstRadio.getCurrentSignalStrength())
|
||||
if (signalStrength > dstRadio.getCurrentSignalStrength()) {
|
||||
dstRadio.setCurrentSignalStrength(signalStrength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Set signal strength on all interferences
|
||||
for (RadioConnection conn : getActiveConnections()) {
|
||||
for (Radio interferedRadio : ((MRMRadioConnection) conn).getInterfered()) {
|
||||
double signalStrength = ((MRMRadioConnection) conn).getInterferenceSignalStrength(interferedRadio);
|
||||
if (signalStrength > interferedRadio.getCurrentSignalStrength())
|
||||
if (signalStrength > interferedRadio.getCurrentSignalStrength()) {
|
||||
interferedRadio.setCurrentSignalStrength(signalStrength);
|
||||
}
|
||||
|
||||
if (!interferedRadio.isInterfered()) {
|
||||
// Set to interfered again
|
||||
|
|
Loading…
Reference in a new issue