Speicherzugriffsfehler?



  • Hallo!

    Benötige ganz dringend Hilfe bei folgendem source:

    #include "LandscapeView.h"
    #include <Inventor/nodes/SoIndexedLineSet.h>
    #include <Inventor/nodes/SoSeparator.h>
    #include <Inventor/nodes/SoCoordinate3.h>
    #include <Inventor/nodes/SoMaterial.h>
    #include <Inventor/nodes/SoTransform.h>
    #include <Inventor/nodes/SoText3.h>
    #include <Inventor/nodes/SoText2.h>
    #include <Inventor/nodes/SoAsciiText.h>
    #include <Inventor/nodes/SoFont.h>
    //#include <Inventor/nodes/SoTexture2.h>
    #include <Inventor/nodes/SoCube.h>
    #include <Inventor/manips/SoHandleBoxManip.h>
    
    #include <SoVRMLElevationGrid.h>
    #include <SoVRMLImageTexture.h>
    
    namespace gui 
    {
    
    LandscapeView::LandscapeView(const Position& origin, const Position& northEast,
    		const std::string& bitmapFilename)
    	 :	WorldComponent(),/*_origin(origin), /*_distanceBetweenLines(3000.0f),*/ /*_distanceChanged(false),*/
    		_baseHeightChanged(false), _baseHeight(0.0f),
    		_bitmap(bitmapFilename), _bitmapChanged(false),
    		_coordinateLabelsVerticalShift(100.0f)
    	{
    		SbRotation rot = SbRotation( SbVec3f(0.0f, 1.0f, 0.0f), 3.14159265f);
    		setRotation( rot );
    		std::pair<float, float> dim =  northEast - origin;
    		_width = dim.first;
    		_height = dim.second;
    		setBoundingBoxPicking( false );
    		setNewShape( createLandscape() );
    }
    
    SoSeparator* LandscapeView::createLandscape()
    {
    	SoSeparator* root = new SoSeparator;
        SoSeparator* map = new SoSeparator;
        SoTransform* moveMap = new SoTransform;
    		/*
    			translation 15749.098 -100.00256 26646.805
    			rotation 0 -1 0  1.5707964
    			scaleFactor 2.2921894 2.2921023 1.6593173
    		*/
    		moveMap->translation = SbVec3f( _width / 2.0f, -100.0f, _height / 2.0f );
    		moveMap->translation = SbVec3f( 15749.098f, -100.0f, 26646.805f );
    		moveMap->rotation = SbRotation( SbVec3f(0.0f, -1.0f, 0.0f), 1.5707964f );
    		moveMap->scaleFactor = SbVec3f( 2.2921894f, 1.0f, 1.6593173f);
    		map->addChild(moveMap);
    
    		//SoMaterial* mapMat = new SoMaterial;
    		//mapMat->transparency = 0.35f;
    		//map->addChild(mapMat);
    
    		// ein erster Versuch:
    		/*SoMaterial* underMat = new SoMaterial;
    		map->addChild(underMat);
            SoTexture2* vrmlfile = new SoTexture2;
    		vrmlfile->filename = "ressources\\welt.wrl";
    		map->addChild(vrmlfile);*/
    
            // das hab ich eingefügt:   
    		// Hard encoded background image
    		//Image, welches auf das nachfolgende Grid abgebildet wird
    		SoVRMLImageTexture* landscape = new SoVRMLImageTexture;
    		landscape->url = "resources\\Welt.jpg";
    		map->addChild(landscape);
    		//SoTexture2* bitmap = new SoTexture2;
    		//bitmap->filename = "resources\\E020N40.gif";
    		//map->addChild( bitmap );
    
    		// ein erster Versuch:
    		//definiert die verschiedenen Höhen in einem Koordinationssystem 
    	    SoVRMLElevationGrid* coordinate = new SoVRMLElevationGrid;
    		coordinate->xDimension = 7; 
    		coordinate->zDimension = 7;
            coordinate->xSpacing = 1;
            coordinate->zSpacing = 1;
            coordinate->height[ 0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00];
    

    Die exe, die diese Klasse mitbenutzt scheint beim gui-Aufrug an der letzten Zeile zu scheitern. Kann mir jemand helfen?



  • Morgen,

    was soll denn die letzte Zeile darstellen? Ein Arrayzugriff ist das jedenfalls
    nicht.

    mfg
    v R



  • Hast Du Recht.
    Die letzte Zeile soll eine Eigenschaft vom coordinate aufrufen, welche diese Zahlen in einem array angeblich speichern kann. Coordinate ist ja ein Objekt vom Typ SoVRMLElevationGrid (welches zur Bibo von Coin3D/OpenInventor gehört).
    Hilft das bei Deiner Hilfe?!



  • Nein, nicht wirklich, wie sieht coordinate denn aus?

    mfg
    v R


Anmelden zum Antworten