mil.dod.th.ose.gui.webapp/src/mil/dod/th/ose/gui/webapp/asset/AssetMgrImpl.java
public void locationUpdate(final int controllerId, final AssetModel asset)
    {
        final AssetExecuteErrorHandler handler = new AssetExecuteErrorHandler(asset.getName());
        
        //Create new coordinates objects
        final LongitudeWgsDegrees newLongitude = LongitudeWgsDegrees.newBuilder().
                setValue(Double.valueOf(asset.getLocation().getLongitude().toString())).
                build();
        
        final LatitudeWgsDegrees newLatitude = LatitudeWgsDegrees.newBuilder().
                setValue(Double.valueOf(asset.getLocation().getLatitude().toString())).
                build();
        
        final HaeMeters newHaeMeters = HaeMeters.newBuilder().
                setValue(Double.valueOf(asset.getLocation().getAltitude().toString())).
                build();
        
        final Coordinates newLocation = Coordinates.newBuilder().
                setAltitude(newHaeMeters).
                setLatitude(newLatitude).
                setLongitude(newLongitude).
                build();
        
        //Create new observation object
        final BankDegrees newBank = BankDegrees.newBuilder().
                setValue(Double.valueOf(asset.getLocation().getBank().toString())).
                build();
        
        final ElevationDegrees newElevation = ElevationDegrees.newBuilder().
                setValue(Double.valueOf(asset.getLocation().getElevation().toString())).
                build();
        
        final HeadingDegrees newHeading = HeadingDegrees.newBuilder().
                setValue(Double.valueOf(asset.getLocation().getHeading().toString())).
                build();
        
        final Orientation newOrientation = Orientation.newBuilder().
                setBank(newBank).
                setHeading(newHeading).
                setElevation(newElevation).
                build();
        
        //Build the base command required for every command message.
        final Command.Builder baseCommand = Command.newBuilder();

        final String sensorId = asset.getSensorId();
        if (sensorId != null && !sensorId.isEmpty())
        {
            sensorIdUpdate(asset);
            baseCommand.setSensorId(sensorId);
        }

        //Create a new command to set the position with the new orientation and location
        final SetPositionCommandGen.SetPositionCommand setPositionProto = SetPositionCommandGen.
                SetPositionCommand.newBuilder().
                setBase(baseCommand).
                setOrientation(newOrientation).
                setLocation(newLocation).
                build();
        
        final ExecuteCommandRequestData executeCommandRequest = ExecuteCommandRequestData.newBuilder().
                setUuid(SharedMessageUtils.convertUUIDToProtoUUID(asset.getUuid())).
                setCommand(setPositionProto.toByteString()).
                setCommandType(CommandTypesGen.CommandType.Enum.SET_POSITION_COMMAND).
                build();
        
        m_MessageFactory.createAssetMessage(AssetMessageType.ExecuteCommandRequest, executeCommandRequest).
            queue(controllerId, handler);
    }
/**
     * Update the location of an asset, get all the various location objects from the asset model.
     * @param controllerId
     *      id of the controller the asset is on
     * @param asset
     *      the asset to update the location
     */
Update the location of an asset, get all the various location objects from the asset model.
@param controllerId
id of the controller the asset is on
@param asset
the asset to update the location
Update the location of an asset get all the various location objects from the asset model . @param controllerId id of the controller the asset is on @param asset the asset to update the location
public void locationUpdate(final int controllerId, final AssetModel asset)
    {
        final AssetExecuteErrorHandler handler = new AssetExecuteErrorHandler(asset.getName());
        final LongitudeWgsDegrees newLongitude = LongitudeWgsDegrees.newBuilder().
                setValue(Double.valueOf(asset.getLocation().getLongitude().toString())).
                build();
        final LatitudeWgsDegrees newLatitude = LatitudeWgsDegrees.newBuilder().
                setValue(Double.valueOf(asset.getLocation().getLatitude().toString())).
                build();
        final HaeMeters newHaeMeters = HaeMeters.newBuilder().
                setValue(Double.valueOf(asset.getLocation().getAltitude().toString())).
                build();
        final Coordinates newLocation = Coordinates.newBuilder().
                setAltitude(newHaeMeters).
                setLatitude(newLatitude).
                setLongitude(newLongitude).
                build();
        final BankDegrees newBank = BankDegrees.newBuilder().
                setValue(Double.valueOf(asset.getLocation().getBank().toString())).
                build();
        final ElevationDegrees newElevation = ElevationDegrees.newBuilder().
                setValue(Double.valueOf(asset.getLocation().getElevation().toString())).
                build();
        final HeadingDegrees newHeading = HeadingDegrees.newBuilder().
                setValue(Double.valueOf(asset.getLocation().getHeading().toString())).
                build();
        final Orientation newOrientation = Orientation.newBuilder().
                setBank(newBank).
                setHeading(newHeading).
                setElevation(newElevation).
                build();
        final Command.Builder baseCommand = Command.newBuilder();
        final String sensorId = asset.getSensorId();
        if (sensorId != null && !sensorId.isEmpty())
        {
            sensorIdUpdate(asset);
            baseCommand.setSensorId(sensorId);
        }
        final SetPositionCommandGen.SetPositionCommand setPositionProto = SetPositionCommandGen.
                SetPositionCommand.newBuilder().
                setBase(baseCommand).
                setOrientation(newOrientation).
                setLocation(newLocation).
                build();
        final ExecuteCommandRequestData executeCommandRequest = ExecuteCommandRequestData.newBuilder().
                setUuid(SharedMessageUtils.convertUUIDToProtoUUID(asset.getUuid())).
                setCommand(setPositionProto.toByteString()).
                setCommandType(CommandTypesGen.CommandType.Enum.SET_POSITION_COMMAND).
                build();
        m_MessageFactory.createAssetMessage(AssetMessageType.ExecuteCommandRequest, executeCommandRequest).
            queue(controllerId, handler);
    }
public void locationUpdate ( final int controllerId , final AssetModel asset ) { final AssetExecuteErrorHandler handler = new AssetExecuteErrorHandler ( asset . getName ( ) ) ; final LongitudeWgsDegrees newLongitude = LongitudeWgsDegrees . newBuilder ( ) . setValue ( Double . valueOf ( asset . getLocation ( ) . getLongitude ( ) . toString ( ) ) ) . build ( ) ; final LatitudeWgsDegrees newLatitude = LatitudeWgsDegrees . newBuilder ( ) . setValue ( Double . valueOf ( asset . getLocation ( ) . getLatitude ( ) . toString ( ) ) ) . build ( ) ; final HaeMeters newHaeMeters = HaeMeters . newBuilder ( ) . setValue ( Double . valueOf ( asset . getLocation ( ) . getAltitude ( ) . toString ( ) ) ) . build ( ) ; final Coordinates newLocation = Coordinates . newBuilder ( ) . setAltitude ( newHaeMeters ) . setLatitude ( newLatitude ) . setLongitude ( newLongitude ) . build ( ) ; final BankDegrees newBank = BankDegrees . newBuilder ( ) . setValue ( Double . valueOf ( asset . getLocation ( ) . getBank ( ) . toString ( ) ) ) . build ( ) ; final ElevationDegrees newElevation = ElevationDegrees . newBuilder ( ) . setValue ( Double . valueOf ( asset . getLocation ( ) . getElevation ( ) . toString ( ) ) ) . build ( ) ; final HeadingDegrees newHeading = HeadingDegrees . newBuilder ( ) . setValue ( Double . valueOf ( asset . getLocation ( ) . getHeading ( ) . toString ( ) ) ) . build ( ) ; final Orientation newOrientation = Orientation . newBuilder ( ) . setBank ( newBank ) . setHeading ( newHeading ) . setElevation ( newElevation ) . build ( ) ; final Command . Builder baseCommand = Command . newBuilder ( ) ; final String sensorId = asset . getSensorId ( ) ; if ( sensorId != null && ! sensorId . isEmpty ( ) ) { sensorIdUpdate ( asset ) ; baseCommand . setSensorId ( sensorId ) ; } final SetPositionCommandGen . SetPositionCommand setPositionProto = SetPositionCommandGen . SetPositionCommand . newBuilder ( ) . setBase ( baseCommand ) . setOrientation ( newOrientation ) . setLocation ( newLocation ) . build ( ) ; final ExecuteCommandRequestData executeCommandRequest = ExecuteCommandRequestData . newBuilder ( ) . setUuid ( SharedMessageUtils . convertUUIDToProtoUUID ( asset . getUuid ( ) ) ) . setCommand ( setPositionProto . toByteString ( ) ) . setCommandType ( CommandTypesGen . CommandType . Enum . SET_POSITION_COMMAND ) . build ( ) ; m_MessageFactory . createAssetMessage ( AssetMessageType . ExecuteCommandRequest , executeCommandRequest ) . queue ( controllerId , handler ) ; }
Update the location of an asset, get all the various location objects from the asset model.
Update the location of an asset get all the various location objects from the asset model .
//Create new coordinates objects //Create new observation object //Build the base command required for every command message. //Create a new command to set the position with the new orientation and location