/** * Handle the bounding box response. */ protected void OnSceneGetBoundingBox(RSResponse resp) { if (resp.IsErrorResponse) { Logger.Log("error", "Error getting scene bounding box: " + resp.ErrorMessage); Status("error", "Error importing scene"); return; } Hashtable bbox = resp.Result as Hashtable; if (bbox == null) { Logger.Log("error", "Scene bounding box result was not an object: " + resp.Result.GetType()); Status("error", "Error importing scene"); return; } BBoxMax = new Vector3D( Convert.ToDouble(bbox["max_x"]), Convert.ToDouble(bbox["max_y"]), Convert.ToDouble(bbox["max_z"])); BBoxMin = new Vector3D( Convert.ToDouble(bbox["min_x"]), Convert.ToDouble(bbox["min_y"]), Convert.ToDouble(bbox["min_z"])); }
/** * This handles the import_scene response */ protected void OnSceneImport(RSResponse resp) { if (resp.IsErrorResponse) { Logger.Log("error", "Error importing scene: " + resp.ErrorMessage); Status("error", "Error importing scene"); if (OnSceneImported != null) { OnSceneImported(resp.ErrorMessage); } } else { Hashtable sceneData = resp.Result as Hashtable; if (sceneData == null) { Logger.Log("error", "Error receiving scene data from import!"); Status("error", "Error importing scene"); if (OnSceneImported != null) { OnSceneImported("No scene data returned from import."); } return; } CameraName = (string)sceneData["camera"]; CameraInstanceName = (string)sceneData["camera_instance"]; OptionsName = (string)sceneData["options"]; RootGroupName = (string)sceneData["rootgroup"]; if (OnSceneImported != null) { OnSceneImported(null); } } }
protected void OnRender(RSResponse resp) { if (resp.IsErrorResponse) { return; } DisplayRender = true; }
protected void OnGetRenderLoopRender(RSResponse resp) { if (Scene.IsShutdown) { return; } // Ignore these renders. if (LastRenderTime > NextRenderTime && OnRender != null) { OnRender(resp); } if (resp.IsErrorResponse) { if (ReceivedFirstRender) { Logger.Log("error", "Error getting render loop render."); Status("error", "Error retrieving render"); NextRenderTimer.Stop(); } NextRenderTimer.Start(); return; } LastRenderResultCounter++; if (LastRenderResultCounter > 5) { LastRenderResultCounter = 0; GetLastRenderResult(); } if (!ReceivedFirstRender) { Status("render", ""); } ReceivedFirstRender = true; if (!IsConverged) { NextRenderTimer.Start(); } }
protected void OnStartRenderLoop(RSResponse resp) { if (resp.IsErrorResponse) { Logger.Log("error", "Error starting render loop: " + resp.ErrorMessage); Status("error", "Error starting render loop"); return; } Status("info", "Waiting for first render"); RenderLoopRunning = true; NextRenderTimer = new Timer(); NextRenderTimer.Interval = RenderLoopInterval; NextRenderTimer.Elapsed += new ElapsedEventHandler((object source, ElapsedEventArgs e) => { GetNextRenderLoopRender(); }); if (RenderLoopTimeout > 100) { PollResultTimer = new Timer(); PollResultTimer.Interval = RenderLoopTimeout * 1000 / 3; PollResultTimer.Elapsed += new ElapsedEventHandler((object source, ElapsedEventArgs e) => { GetPollResult(); }); PollResultTimer.Start(); } RestartLoop(); }