public void Initialize(JaguarCtrl jc) { centerLatitude = jc.jaguarSetting.GoogleEarthStartLat.ToString(); centerLongitude = jc.jaguarSetting.GoogleEarthStartLong.ToString(); jc.txtStartLat.Text = centerLatitude; jc.txtStartLong.Text = centerLongitude; if (true)//(jc.DesignMode == false) { googleEarth = new ApplicationGEClass(); MessageBox.Show("Waiting for GoogleEarth to be loaded…. \n This may take a while.When the GoogleEarth is shown, click OK to continue.", "DrRobot Jaguar Control", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); //ShowWindowAsync(googleEarth.GetMainHwnd(), 0); GEHrender = (IntPtr)googleEarth.GetRenderHwnd(); GEParentHrender = GetParent(GEHrender); MoveWindow(GEHrender, 0, 0, jc.panelGE.Width, jc.panelGE.Height, true); SetParent(GEHrender, jc.panelGE.Handle); // don'tdo it now , we keep google earth window to clear the KML data in temporary node //Hide the main GE window //SetWindowPos(googleEarth.GetMainHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE + SWP_HIDEWINDOW); } }
/// <summary>Load GoogleEarth to a new Panel /// Load GoogleEarth to a new Panel /// </summary> public void LoadGoogleEarth() { //将GoogleEarth加载到窗口上 myGEHandler = new SetGEHandler(); _geApp = new ApplicationGEClass(); myGEHandler.SetGEHandlerToControl(this.pnlGoogleEarth, _geApp); _gEHandler = (IntPtr)_geApp.GetRenderHwnd(); this.StartMouseHook(); }
private void JaguarCtrl_Load(object sender, EventArgs e) { for (int i = 0; i < 2; i++) { armMotor[i] = new MotorData(); } myJaguar.connectRobot (jaguarSetting.RobotID); //for google earth application cenerLatitude = jaguarSetting.GoogleEarthStartLat.ToString (); centerLongitude = jaguarSetting.GoogleEarthStartLong.ToString(); txtStartLat.Text = cenerLatitude; txtStartLong.Text = centerLongitude; if (this.DesignMode == false) { googleEarth = new ApplicationGEClass(); MessageBox.Show("Waiting for GoogleEarth to be loaded…. \n This may take a while.When the GoogleEarth is shown, click OK to continue.", "DrRobot Jaguar Control", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); //ShowWindowAsync(googleEarth.GetMainHwnd(), 0); GEHrender = (IntPtr)googleEarth.GetRenderHwnd(); GEParentHrender = GetParent(GEHrender); MoveWindow(GEHrender, 0, 0, this.panelGE.Width, this.panelGE.Height, true); SetParent(GEHrender, this.panelGE.Handle); // don'tdo it now , we keep google earth window to clear the KML data in temporary node //Hide the main GE window //SetWindowPos(googleEarth.GetMainHwnd(), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE + SWP_HIDEWINDOW); } //for Axis camera try { // Set properties, deciding what url completion to use by MediaType. myAMC.MediaUsername = jaguarSetting.CameraUser; myAMC.MediaPassword = jaguarSetting.CameraPWD; myAMC.MediaType = "mjpeg"; myAMC.MediaURL = CompleteURL(jaguarSetting.CameraIP + ":" + jaguarSetting .CameraPort , "mjpeg"); myAMC.AudioConfigURL = "http://" + jaguarSetting.CameraIP + ":" + jaguarSetting .CameraPort + "/axis-cgi/view/param.cgi?camera=1&action=list&group=Audio,AudioSource.A0"; /* myAMC.PTZControlURL = "http://" + jaguarSetting.CameraIP + ":" + jaguarSetting.CameraPort + "/axis-cgi/com/ptz.cgi"; myAMC.UIMode = "ptz-absolute"; myAMC.ShowToolbar = true; myAMC.StretchToFit = true; myAMC.EnableContextMenu = true; myAMC.ToolbarConfiguration = "default,+ptz"; */ myAMC.ToolbarConfiguration = "default, + audiocontrol,+ rec"; myAMC.AudioReceiveStop(); // Start the streaming myAMC.Play(); myAMC.AudioReceiveURL = "http://" + jaguarSetting.CameraIP + ":" + jaguarSetting .CameraPort + "/axis-cgi/audio/receive.cgi"; myAMC.Volume = 100; //myAMC.AudioReceiveStart(); myAMC.AudioTransmitURL = "http://" + jaguarSetting.CameraIP + ":" + jaguarSetting.CameraPort + "/axis-cgi/audio/transmit.cgi"; } catch (Exception ex) { MessageBox.Show(this, "Unable to play stream: " + ex.Message); } //for joystick control if (InitDirectInput()) tmrJoyStickPoll.Enabled = true; //for GPS/IMU communication if ((jaguarSetting.IMUIP !="0.0.0.0") && (jaguarSetting .GPSIP != "0.0.0.0")) { startComm (); } // for laser scan if ((jaguarSetting.LaserRangeIP != "0.0.0.0") && (jaguarSetting.LaserRangePort != 0)) { startCommLaser(); btnLaserScan.Enabled = true; } else { btnLaserScan.Enabled = false; } drawLaserBackground(); MOTDIR = jaguarSetting .MotorDir; if (jaguarSetting.RobotType.ToLower() == "jaguar") { armPosIndicator.SetArmPositionIndicatorParameters(0,0); pictureBoxRobot.SendToBack(); armPosIndicator.BringToFront(); lblMot1.Text = "Front Arm Motor:"; lblMot2.Text = "Reserved:"; lblMot3.Text = "Left Track Motor:"; lblMot4.Text = "Right Track Motor:"; btnDisArm.Visible = true; } else if (jaguarSetting.RobotType.ToLower() == "jaguar_4arms") { armPosIndicator.Set2ArmCtrl(true); armPosIndicator.SetArmPositionIndicatorParameters(0, 0); pictureBoxRobot.SendToBack(); armPosIndicator.BringToFront(); lblMot1.Text = "Front Arm Motor:"; lblMot2.Text = "Rear Arm Motor:"; lblMot3.Text = "Left Track Motor:"; lblMot4.Text = "Right Track Motor:"; btnDisArm.Visible = true; } else { armPosIndicator.SendToBack(); pictureBoxRobot.BringToFront(); btnDisArm.Visible = false; if (jaguarSetting.RobotType.ToLower() == "jaguar_lite") { pictureBoxRobot.Image = imageList2.Images[0]; lblMot1.Text = "Left Track Motor:"; lblMot2.Text = "Right Track Motor:"; lblMot3.Visible = false; lblMot4.Visible = false; lblEncoderPos3.Visible = false; lblEncoderPos4.Visible = false; lblVel3.Visible = false; lblVel4.Visible = false; lblTemp3.Visible = false; lblTemp4.Visible = false; } else if (jaguarSetting.RobotType.ToLower() == "jaguar_4x4track") { pictureBoxRobot.Image = imageList2.Images[1]; lblMot1.Text = "Left Front Motor:"; lblMot2.Text = "Right Front Motor:"; lblMot3.Text = "Left Rear Motor:"; lblMot4.Text = "Right Rear Motor:"; } else //if (jaguarSetting.RobotType.ToLower() == "jaguar_4x4wheel") { pictureBoxRobot.Image = imageList2.Images[2]; lblMot1.Text = "Left Front Wheel:"; lblMot2.Text = "Right Front Wheel:"; lblMot3.Text = "Left Rear Wheel:"; lblMot4.Text = "Right Rear Wheel:"; } } pictureBoxStuckDetect.BackColor = Color.Green; btnScan.Enabled = false; }