LouiZeForum

3D vrml
 
HomeHome  FAQFAQ  SearchSearch  RegisterRegister  MemberlistMemberlist  UsergroupsUsergroups  Log in  3Dchats / forums3Dchats / forums  

Share | 
 

 OCTAGA

View previous topic View next topic Go down 
AuthorMessage
tutancamon
+200
+200


Number of posts : 685
Age : 54
Localisation : Europa / România / Bucuresti
Registration date : 2007-09-07

PostSubject: OCTAGA   Tue 9 Nov - 19:21

Octaga Visual Solutions





















































Back to top Go down
View user profile http://vrmlserver.xooit.com/index.php
tutancamon
+200
+200


Number of posts : 685
Age : 54
Localisation : Europa / România / Bucuresti
Registration date : 2007-09-07

PostSubject: OCTAGA activeX   Tue 9 Nov - 19:25

Wink

http://www.octaga.com/OctagaEnterpriseSDK/internal/ActiveX/examples/IfcDemo/index_high.htm

activeX

Code:

<object id="enterprise" classid="clsid:E109A779-31B3-4FAB-8C5A-7AC9E76F1585" codebase="http://www.octaga.com/OctagaEnterpriseSDK/internal/ActiveX/releases/2.2.7.20/SetupOctagaEnterpriseActiveX.CAB#Version=2,2,7,20">
<param name="ConfigFile" value="http://www.octaga.com/OctagaEnterpriseSDK/internal/ActiveX/config/config_high.xml" />           
</object>

demo.js

Code:

var control;
var is_initialized;

function initDemo() {
    control = document.getElementById("enterprise");
    is_initialized = false;   
    if (isEnterpriseAvailable()) {
        loadModel();
    } else {
        displayEnterpriseUnavailableMessage();
    }
}

function isEnterpriseAvailable() {   
    if (control == null)
        return false;
    // verify the getBrowser function exists on the control:
    if (control.getBrowser == null)
        return false;
    return true;
}

function displayEnterpriseUnavailableMessage() {
    var rightElement = document.getElementById("right");   
    var control = document.getElementById("enterprise");
    rightElement.removeChild(control);   
    var par = document.createElement("p");
    par.className = "enterprise_unavailable"; 
    par.innerHTML = "Octaga Enterprise SDK - ActiveX component is unavailable. Make sure you are running in Internet Explorer";
    rightElement.appendChild(par);
}

function loadModel() {   
    var browser = control.getBrowser();   
    browser.browserChanged = function(eventType) {
        if (eventType == "Initialized") {
            is_initialized = true;
            initBrowser(browser);
        }
    }   
    browser.loadURL("http://www.octaga.com/OctagaEnterpriseSDK/internal/ActiveX/models/Sorthoj-23.08.omc");
    http://browser.loadURL("http://www.octaga.com/OctagaEnterpriseSDK/internal/ActiveX/models/Sorthoj-06.10.omc");
}

// set default parameters for the model
function initBrowser(browser) {
    var model = browser.getModel();
    // set up navigation to be "EXAMINE" and with collision detection turned off
    var navigationObject = model.getNavigationObject();
    navigationObject.setValue("CurrentType", "EXAMINE");
    navigationObject.setValue("CollisionDetection", false);
    // test model works better with a lower speed (default is 10)
    navigationObject.setValue("Speed", 1.0);
    // set up the afterSelect callback. Every time you select an object in the 3D scene,
    // the function specified here (in this case: updateSelectedObjectGUI) will be called
    model.afterSelect = updateSelectedObjectGUI;
}

// our afterSelect callback. Updates the selectedObjectGUI panel with the information
// related to the selected object.
function updateSelectedObjectGUI(selectedObject)
{
  // check to see if the selectedObject is an IfcProduct. If not, hide the GUI HTML DIV element,
  // else show it and fill in the information.
  if (selectedObject instanceof IfcProduct) {
    document.getElementById('selectedObjectGUI').style.visibility = 'visible';
    document.getElementById('GUIDLabel').innerText = selectedObject.getGuid();   
    document.getElementById('TypeLabel').innerText = selectedObject.getTypeName();
    var name = selectedObject.getObjectName();
    if (name == null) {
        name = "";
    }
    document.getElementById('NameLabel').innerText = name;
  } else {
    document.getElementById('selectedObjectGUI').style.visibility = 'hidden';
    document.getElementById('GUIDLabel').innerText = "";   
    document.getElementById('TypeLabel').innerText = "";
    document.getElementById('NameLabel').innerText = "";
  }   
}

// the functions on the left panel
///////////////////////////////////////////////////////////////////////////////////

// reset the model; if you have hidden elements or changed the color, this resets every
// IfcProduct (since they are children of the top IfcBuilding) to their original value
function reset()
{
    if (!is_initialized)
        return;
   
    var model = control.getBrowser().getModel();
    var buildings = model.getObjectsByType("IfcBuilding");
    for (var key in buildings)
    {
        var building = buildings[key];
        building.show();
        building.resetColor();
    }   
}

function showOnlyWalls()
{
    if (!is_initialized)
        return;
       
    reset();
    var model = control.getBrowser().getModel();
    var buildings = model.getObjectsByType("IfcBuilding");
    for (var key in buildings)
    {
        var building = buildings[key];
        building.hide();
    }
   
    var walls = model.getObjectsByType("IfcWall");
    for (var key in walls)
    {
        var wall = walls[key];
        wall.show();
    }
}

function makeWallsTransparent()
{
    if (!is_initialized)
        return;
 
    var model = control.getBrowser().getModel();
    var color = new Color4(0.8, 0.8, 0.8, 0.4);
    var walls = model.getObjectsByType("IfcWall");
    for (var key in walls)
    {
        var wall = walls[key];
        wall.setColor(color);
    }
}

function showOnlySpaces()
{
    if (!is_initialized)
        return;
       
    reset();
    var model = control.getBrowser().getModel();
    var buildings = model.getObjectsByType("IfcBuilding");
    for (var key in buildings)
    {
        var building = buildings[key];
        building.hide();
    }
   
    var spaces = model.getObjectsByType("IfcSpace");
    for (var key in spaces)
    {
        var space = spaces[key];
        space.show();
    }
}

function makeSpacesBlue()
{
    if (!is_initialized)
        return;
       
    var model = control.getBrowser().getModel();

    var color = new Color4(0, 0, 1, 1);
   
    var spaces = model.getObjectsByType("IfcSpace");
    for (var key in spaces)
    {
        var space = spaces[key];
        space.setColor(color);
    }
}

function zoomToSelectedIfcProduct()
{
  if (!is_initialized)
    return;
       
  var selectedObject = control.getBrowser().getModel().getSelectedObject();
  if (selectedObject instanceof IfcProduct) {
    selectedObject.lookAt();
  }
}

function showHideSelectedIfcProduct()
{
  if (!is_initialized)
    return;

  var selectedObject = control.getBrowser().getModel().getSelectedObject();
  if (selectedObject instanceof IfcProduct) {
    if (selectedObject.isHidden()) {
      document.getElementById('showHideLink').innerText = "Hide";   
      selectedObject.show();
    } else {
      document.getElementById('showHideLink').innerText = "Show";         
      selectedObject.hide();
    }
  }
}

///////////////////////////////////////////////////////////////////////////////////


config_high.xml

Code:

  <?xml version="1.0" standalone="yes" ?>
- <!--  The Octaga options file
  -->
- <Octaga>
- <Key name="rendering">
  <Bool name="waitForResources" value="true" />
  <Int name="performance" value="11" />
- <Key name="openGL">
  <Bool name="antiAliasing" value="true" />
  </Key>
- <!--  openGL
  -->
  </Key>
- <!--  rendering
  -->
  </Octaga>
Back to top Go down
View user profile http://vrmlserver.xooit.com/index.php
 
OCTAGA
View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
LouiZeForum :: ARTS :: 3D art :: 3D FAQ and News-
Jump to: