Пример #1
0
      void
      MinimalTIFFWriter::setupIFD() const
      {
        // Default to single strips for now.
        ifd->setImageWidth(getSizeX());
        ifd->setImageHeight(getSizeY());

        ifd->setTileType(tiff::STRIP);
        ifd->setTileWidth(getSizeX());
        ifd->setTileHeight(1U);

        ome::compat::array<dimension_size_type, 3> coords = getZCTCoords(getPlane());

        dimension_size_type channel = coords[1];

        ifd->setPixelType(getPixelType());
        ifd->setBitsPerSample(bitsPerPixel(getPixelType()));
        ifd->setSamplesPerPixel(getRGBChannelCount(channel));

        const boost::optional<bool> interleaved(getInterleaved());
        if (isRGB(channel) && interleaved && *interleaved)
          ifd->setPlanarConfiguration(tiff::CONTIG);
        else
          ifd->setPlanarConfiguration(tiff::SEPARATE);

        // This isn't necessarily always true; we might want to use a
        // photometric interpretation other than RGB with three
        // subchannels.
        if (isRGB(channel) && getRGBChannelCount(channel) == 3)
          ifd->setPhotometricInterpretation(tiff::RGB);
        else
          ifd->setPhotometricInterpretation(tiff::MIN_IS_BLACK);
      }
Пример #2
0
bool StGLStereoFrameBuffer::initLazy(StGLContext&  theCtx,
                                     const GLsizei theSizeX,
                                     const GLsizei theSizeY,
                                     const bool    theNeedDepthBuffer,
                                     const bool    theToCompress) {
    if(isValid()
    && (theSizeX <= getSizeX() && getSizeX() < theCtx.getMaxTextureSize())
    && (theSizeY <= getSizeY() && getSizeY() < theCtx.getMaxTextureSize())) {
        if(!theToCompress
        || (((getSizeX() - theSizeX) < 256)
        &&  ((getSizeY() - theSizeY) < 256))) {
            setVPDimensions(theCtx, theSizeX, theSizeY);
            return true;
        }
    }
    release(theCtx);

    GLsizei aSizeX = stMax(32, (GLsizei )getAligned(theSizeX, 256));
    GLsizei aSizeY = stMax(32, (GLsizei )getAligned(theSizeY, 256));
    if(!theCtx.arbNPTW) {
        StGLFrameBuffer::convertToPowerOfTwo(theCtx, aSizeX, aSizeY);
    }

    if(!init(theCtx, aSizeX, aSizeY, theNeedDepthBuffer)) {
        return false;
    }

    theCtx.stglFillBitsFBO(myGLFBufferIds[StGLStereoTexture::LEFT_TEXTURE], aSizeX, aSizeY);
    ST_DEBUG_LOG("FBO resized to " + aSizeX + " x " + aSizeY + " (for " + theSizeX + " x " + theSizeY + ")");

    setVPDimensions(theCtx, theSizeX, theSizeY);
    return true;
}
Пример #3
0
void HexagonGame::recreateTextures()
{
    gameTexture.create(getSizeX(), getSizeY(), 32);
    gameTexture.setView(View{Vector2f{0,0}, Vector2f{getSizeX() * getZoomFactor(), getSizeY() * getZoomFactor()}});
    gameTexture.setSmooth(true);
    gameSprite.setTexture(gameTexture.getTexture(), false);
    gameSprite.setOrigin(getSizeX()/ 2, getSizeY()/ 2);
    gameSprite.setPosition(window.getWidth() / 2, window.getHeight() / 2);
}
Пример #4
0
// getClientRect
//---------------------------------------------------------------------------
// Purpose:
//---------------------------------------------------------------------------
iRect View::getClientRect() const
{
    if (getBordered()) {
        return iRect( borderSize,
                      borderSize + moveAreaHeight,
                      getSizeX() - borderSize,
                      getSizeY() - borderSize);
    }

    return iRect(0, 0, getSizeX(), getSizeY());

} // end View::getClientRect
void TPZNetworkSquareMidimew :: initializeConnectionsFor(const TPZPosition& pos)
{
   /* Make connections to router at position 'pos' */
   TPZRouter* router = getRouterAt(pos);
   int myNum=pos.valueForCoordinate(TPZPosition::X);
   int sy = (int)sqrt((float)getSizeX());
   int sx = sy/2 - 1;
   int n = getSizeX();


   /* Get neighbouring routers */
   TPZRouter* routerXp = getRouterAt(CreatePosition( (myNum+sx)%n ));
   TPZRouter* routerXm = getRouterAt(CreatePosition( (myNum-sx+n)%n ));
   TPZRouter* routerYp = getRouterAt(CreatePosition( (myNum+sy)%n ));
   TPZRouter* routerYm = getRouterAt(CreatePosition( (myNum-sy+n)%n ));

   /* Get input port numbers */ 
   unsigned iXp = router->getInputWithType(_Xplus_);
   unsigned iXm = router->getInputWithType(_Xminus_);
   unsigned iYp = router->getInputWithType(_Yplus_);
   unsigned iYm = router->getInputWithType(_Yminus_);
   
   /* Get output port numbers */ 
   unsigned oXp = router->getOutputWithType(_Xplus_);
   unsigned oXm = router->getOutputWithType(_Xminus_);
   unsigned oYp = router->getOutputWithType(_Yplus_);
   unsigned oYm = router->getOutputWithType(_Yminus_);
   
   /* Make the connections */
   if( iXp && oXp )
      TPZConnection::connectInterfaces( this,
                                        router->getOutputInterfaz(oXp),
                                        routerXp->getInputInterfaz(iXp) );

   if( iXm && oXm )
      TPZConnection::connectInterfaces( this,
                                        router->getOutputInterfaz(oXm),
                                        routerXm->getInputInterfaz(iXm),
                                        getConnectionDelay() );

   if( iYp && oYp )
      TPZConnection::connectInterfaces( this,
                                        router->getOutputInterfaz(oYp),
                                        routerYp->getInputInterfaz(iYp),
                                        getConnectionDelay() );

   if( iYm && oYm )
      TPZConnection::connectInterfaces( this,
                                        router->getOutputInterfaz(oYm),
                                        routerYm->getInputInterfaz(iYm),
                                        getConnectionDelay() );
}
Пример #6
0
void VoxelField::setSpheres( float phase )
{
	setAllValues( -0.5f );
	float x = 0.3 * getSizeX() * sin(phase*0.1) + 0.5 * getSizeX();
	float y = 0.3 * getSizeY() * cos(phase*0.2) + 0.5 * getSizeY();
	float z = 0.3 * getSizeZ() * sin(1+phase*0.15) + 0.5 * getSizeZ();
	float rad = getSizeX() / 3;
	addSphere( x, y, z, rad );
	addSphere( y, z, x, rad );
	addSphere( z, x, y, rad );

	addSphere( z, y, x, rad );
	addSphere( y, x, z, rad );
	addSphere( x, z, y, rad );
}
Пример #7
0
			void equalizeHistogram ()
			{
				real_array_type rdata( boost::extents[getSizeX()][getSizeY()] );
				Abstract2dData::getRealSpaceData(&rdata);
				SingleParticle2dx::Utilities::DataContainerFunctions::equalizeHistogram(&rdata);
				Abstract2dData::setFourierSpaceData(&rdata);
			}
Пример #8
0
bool FieldExporter::FieldExporterCSV::save(const FieldHorizontalPlane* plane, std::string filename, double min_value, bool save3d, int numdec)
{
	if (Config::getInstance().isWarnOverwriteSimulations() && Utils::abortOnExistingAndDontOverwrite(filename))
		return false;

	try {
		const auto values = plane->get();

		FileWriter bw(filename);
		bw.write("X\tY\t" + (save3d ? "Z\t" : std::string("")) + "CE(V/m)\n");
		const double Z = plane->getZ();

		for (unsigned yi = 0; yi<values.getSizeY(); yi++) {
			const double realy = plane->getCoordY(yi);

			for (unsigned xi = 0; xi<values.getSizeX(); xi++) {
				const double realx = plane->getCoordX(xi);;

				const double value = values.get(xi, yi);
				if (min_value <= 0 || value>min_value)
					bw.write("" + std::to_string(realx) + "\t" + std::to_string(realy) + "\t" + (save3d ? std::to_string(Z) + "\t" : "") + Utils::formatDouble(value, numdec) + "\n");
			}
		}

		bw.close();
		return true;
	}
	catch (const std::exception& e) {
		Utils::MessageBox("Error saving Field:\n" + std::string(e.what()), "ERROR");
		return false;
	}
}
Пример #9
0
void SingleParticle2dx::DataStructures::Particle::flipXYAxis()
{
	real_array_type rdata( boost::extents[getSizeX()][getSizeY()] );
	getRealSpaceData(&rdata);
	SingleParticle2dx::Utilities::DataContainerFunctions::applyMirrorXY(&rdata);
	setFourierSpaceData(&rdata);
}
Пример #10
0
			void addGaussianNoise(value_type sd)
			{
				real_array_type rdata( boost::extents[getSizeX()][getSizeY()] );
				Abstract2dData::getRealSpaceData(&rdata);
				SingleParticle2dx::Utilities::DataContainerFunctions::addGaussianNoise(&rdata, sd);
				SingleParticle2dx::Utilities::DataContainerFunctions::normalizeRealSpaceData(&rdata);
				Abstract2dData::setFourierSpaceData(&rdata);
			}
Пример #11
0
// Tests to see if we can move dx, dy; returns true if we can
bool Block::testMove(const int dx, const int dy) const
{
   return (
         (x + dx) >= 1 &&
         (x + getSizeX() + dx - 1) <= BOARD_X_SIZE &&
         (y + dy) >= 1 &&
         (y + getSizeY() + dy - 1) <= BOARD_Y_SIZE
      );
}
Пример #12
0
void StGLStereoFrameBuffer::setVPDimensions(StGLContext&  theCtx,
                                            const GLsizei theSizeX,
                                            const GLsizei theSizeY) {
    GLsizei aVPSizeX = stMin(theSizeX, getSizeX());
    GLsizei aVPSizeY = stMin(theSizeY, getSizeY());
    if(aVPSizeX != myViewPortX
    || aVPSizeY != myViewPortY) {
        GLfloat aDX = GLfloat(aVPSizeX) / GLfloat(getSizeX());
        GLfloat aDY = GLfloat(aVPSizeY) / GLfloat(getSizeY());
        StArray<StGLVec2> aTCoords(4);
        aTCoords[0] = StGLVec2(aDX,  0.0f);
        aTCoords[1] = StGLVec2(aDX,  aDY);
        aTCoords[2] = StGLVec2(0.0f, 0.0f);
        aTCoords[3] = StGLVec2(0.0f, aDY);
        myTexCoordBuf.init(theCtx, aTCoords);
        myViewPortX = aVPSizeX;
        myViewPortY = aVPSizeY;
    }
}
Пример #13
0
void Window::processCommands(CommunicationBuffer* fromGame, CommunicationBuffer* toGame)
{
    core::WinMsg cmd;
    while( fromGame->peek(cmd) )
    {
        switch( cmd.type )
        {
        case core::WinMsgType::LockCursor:
        {
            setLockCursor(cmd.lockCursor);
        }
        break;
        case core::WinMsgType::ShowCursor:
        {
            setShowCursor(cmd.showCursor);
        }
        break;
        case core::WinMsgType::RelativeCursor:
        {
            setRelativeCursor(cmd.relativeCursor);
        }
        break;
        case core::WinMsgType::Fullscreen:
        {
            setFullscreen(cmd.fullscreen);
        }
        break;
        case core::WinMsgType::Size:
        {
            resize(cmd.screen.x, cmd.screen.y);
            WinMsg msg{};
            msg.type = core::WinMsgType::Size;
            msg.screen.x = getSizeX();
            msg.screen.y = getSizeY();
            toGame->writeEvent(msg);
        }
        break;
        case core::WinMsgType::Position:
        {
            move(cmd.screen.x, cmd.screen.y);
        }
        break;
        case core::WinMsgType::FileChange:
        {
            monitorDirectoryForChanges(cmd.fileChange.name);
        }
        break;
        case core::WinMsgType::Close:
        {
            close();
        }
        break;
        }
    }
}
Пример #14
0
void SingleParticle2dx::DataStructures::Particle::scale(value_type s)
{
	if ( fabs(s-value_type(1)) < 1e-5 )
	{
		//std::cout << "don't scale, factor to close to zero" << std::endl;
		return;
	}
	
	real_array_type rdata( boost::extents[getSizeX()][getSizeY()] );
	real_array_type rdata2set( boost::extents[getSizeX()][getSizeY()] );
	getRealSpaceData(&rdata);
	
	size_type n = getSizeX();
	
	value_type pos_x, pos_y;
	size_type x_l, x_u, y_l, y_u;
	value_type s_x, s_y;
	
	for(size_type i=0; i<n; i++)
	{
		for(size_type j=0; j<n; j++)
		{
			pos_x = ((i-n/2)*s) + n/2;
			pos_y = ((j-n/2)*s) + n/2;
			
			x_l = floor(pos_x);
			x_u = x_l+1;
			
			y_l = floor(pos_y);
			y_u = y_l+1;
			
			s_x = pos_x - x_l;
			s_y = pos_y - y_l;
			
			rdata2set[i][j] = (1-s_x) * (1-s_y) * rdata[x_l][y_l]
							+ (1-s_x) * (  s_y) * rdata[x_l][y_u]
							+ (  s_x) * (1-s_y) * rdata[x_u][y_l]
							+ (  s_x) * (  s_y) * rdata[x_u][y_u];
		}
	}	
	setFourierSpaceData(&rdata2set);
}
Пример #15
0
TPZString TPZNetworkSquareMidimew :: asString() const
{
   TPZGlobalData& data = ((TPZSimulation*)getSimulation())->globalData((TPZNetwork*)this);
   TPZString rs= "SquareMidimew(";
   rs +=  TPZString(getSizeX()) + "," +
          TPZString(getSizeY()) + "," +
          TPZString(getSizeZ()) + ")" +
          "\n Buffer control : " + data.routerBufferControl() +
          "\n Routing control: " + data.routerRoutingControl();
   return rs;
}
Пример #16
0
bool FieldExporter::FieldExporterCSV::save(const FieldHeights* field, std::string filename, std::string separator, int xdigits, int ydigits)
{
	if (Config::getInstance().isWarnOverwriteSimulations() && Utils::abortOnExistingAndDontOverwrite(filename))
		return false;

	try {
		const auto minvalues = field->getMinvalues();
		const auto maxvalues = field->getMaxvalues();
		const glm::vec2 spacing = field->getSpacing();
		const glm::vec2 center = field->getCenter();

		FileWriter bw(filename);
		bw.write("X" + separator + "Y" + separator + "Hmin" + separator + "Hmax\n");
		const double spacingx = spacing.x;
		const double spacingy = spacing.y;

		for (unsigned yi = 0; yi<minvalues.getSizeY(); yi++) {
			const double realy = center.y + spacingy*(yi - (static_cast<double>(minvalues.getSizeY()) - 1) / 2);

			for (unsigned xi = 0; xi<minvalues.getSizeX(); xi++) {
				const double realx = center.x + spacingx*(xi - (static_cast<double>(minvalues.getSizeX()) - 1) / 2);

				// salva solo se in questo punto esiste (almeno) un'altezza (con valore di campo > examination_value)
				const double minvalue = minvalues.get(xi, yi);
				const double maxvalue = maxvalues.get(xi, yi);

				if (minvalue != FieldHeights::UNUSED || maxvalue != FieldHeights::UNUSED)
					bw.write("" + Utils::formatDouble(realx, xdigits) + separator + Utils::formatDouble(realy, xdigits)
						+ separator + (minvalue != FieldHeights::UNUSED ? Utils::formatDouble(minvalue, ydigits) : "")
						+ separator + (maxvalue != FieldHeights::UNUSED ? Utils::formatDouble(maxvalue, ydigits) : "") + "\n");
			}
		}

		bw.close();
		return true;
	}
	catch (const std::exception& e) {
		Utils::MessageBox("Error saving FieldHeights:\n" + std::string(e.what()), "ERROR");
		return false;
	}
}
Пример #17
0
//------------------------------------------------------------------------------
// collisionCheck() -- True if we collide with the test block
//------------------------------------------------------------------------------
bool Block::collisionCheck(const Block* const b2) const
{
  bool c = false;
  for (unsigned int i = 0; i < getSizeX() && !c; i++)
    for (unsigned int j = 0; j < getSizeY() && !c; j++) {
       unsigned int xx = x + i;
       unsigned int yy = y + j;
       if ( xx >= b2->x && xx <= (b2->x + b2->getSizeX() - 1) &&
            yy >= b2->y && yy <= (b2->y + b2->getSizeY() - 1) ) c = true;
    }
  return c;
}
Пример #18
0
// init
//---------------------------------------------------------------------------
void PlayerNameView::init()
{
    playerName = new InputField();
    playerName->setLocation(iXY(BORDER_SPACE, BORDER_SPACE));
    playerName->setSize(getSizeX()-20, 16);
    playerName->setMaxTextLength(INPUT_FIELD_CHARACTERS * 2); // XXX *2 for testing only
    playerName->setExcludedChars("\\");
    playerName->setText(*GameConfig::player_name);

    add(playerName);
    
} // end PlayerNameView::init
Пример #19
0
			void setMidddleTarget()
			{
				size_type n = getSizeX();
				real_array_type rdata( boost::extents[getSizeX()][getSizeY()] );
				
				normalizeRealSpace();
				getRealSpaceData(&rdata);
				
				for(size_type i=0; i<n; i++)
				{
					for(size_type j=0; j<n; j++)
					{
						if( (i==n/2) || (j==n/2) || ((i-1)==n/2) || ((j-1)==n/2) )
						{
							rdata[i][j] += 2.5;
						}
					}
				}
				normalizeRealSpace();
				setFourierSpaceData(&rdata);
			}
Пример #20
0
// Tests to see if we can move dx, dy; returns true if we can
bool Block::testMove(const int dx, const int dy, const Puzzle* const puz) const
{
   bool ok = false;
   if (puz != 0) {
      ok = (
            (x + dx) >= 1 &&
            (x + getSizeX() + dx - 1) <= puz->getBoardSizeX() &&
            (y + dy) >= 1 &&
            (y + getSizeY() + dy - 1) <= puz->getBoardSizeX()
         );
   }
   return ok;
}
Пример #21
0
// getClientArea
//---------------------------------------------------------------------------
// Purpose:
//---------------------------------------------------------------------------
Surface* View::getClientArea(Surface& dest)
{
    Surface* viewarea = getViewArea(dest);
    if (getBordered()) {
        iRect rect( borderSize, borderSize+moveAreaHeight,
                    getSizeX() - borderSize, getSizeY() - borderSize );
        Surface *ns = new Surface();
        ns->setTo(*viewarea, rect);
        delete viewarea;
        return ns;
    }

    return viewarea;
} // end View::getClientArea
Пример #22
0
			/** 
			 *  @brief      Write interally stored data to file
			 *  @details    Performs a BW-FFT and stores the result to a .mrc-file
			 *              Result is normalized. Don't forget to pass the .mrc-ending
			 *  @param[in]  filename Where to store the real space data
			 */
			void writeToFile (std::string filename)
			{
				std::cout << "Storing 2d data to file" << std::endl;
				real_array_type rdata( boost::extents[getSizeX()][getSizeY()] );
				getRealSpaceData(&rdata);
				
				if(SingleParticle2dx::Utilities::DataContainerFunctions::checkData(&rdata))
				{
					std::cerr << "bad 2d structure to store" << std::endl;
					throw std::runtime_error("Bad operation");
				}
				
				SingleParticle2dx::Utilities::MRCFileIO::writeToMrc(&rdata, filename);
			}
Пример #23
0
void TPZNetworkSquareMidimew :: routingRecord( const TPZPosition& org, 
                                       const TPZPosition& dst,
                                       int&  deltaX,
                                       int&  deltaY,
                                       int&  deltaZ,
                                       Boolean ordered  )
{
   /* Calculate routing record */
   int origen=org.valueForCoordinate(TPZPosition::X);
   int destino=dst.valueForCoordinate(TPZPosition::X);
   int m = (destino-origen+getSizeX()) % getSizeX();
   
   /* Use lookup table */
   deltaX = m_routingTable[2*(m-1)];
   deltaY = m_routingTable[2*(m-1)+1];
   deltaZ = 0;
   
   /* Routing record values must be incremented by 1 or -1 
    * depending on their sign */
   deltaX = (deltaX>=0) ? deltaX+1 : deltaX-1;
   deltaY = (deltaY>=0) ? deltaY+1 : deltaY-1;
   deltaZ = 1;//(deltaZ>=0) ? deltaZ+1 : deltaZ-1;
}
Пример #24
0
void TPZNetworkSquareMidimew :: initialize()
{
   if( isInitializated() ) return;
   
   /* Check consistency of parameters */
   if(getSizeY()!=1 ||getSizeZ()!=1)
   {
     TPZString err;
     err.sprintf( ERR_TPZTONET_002, (char*)getRouterId() );
     err.sprintf("\nSquare Midimew Network Ysize and Zsize must be 1. Al nodes in Xsize!");
     EXIT_PROGRAM(err); 
   }

   if((int)ceil(sqrt((float)getSizeX()))%2 || getSizeX() < 4 )
   {
     TPZString err;
     err.sprintf( ERR_TPZTONET_002, (char*)getRouterId() );
     err.sprintf("\n Square Midimew Network Xsize must be an even 2's power(4,16,64,256,1024,4096...)");
     EXIT_PROGRAM(err); 
   }

   if( !getSizeX() || !getSizeY() || !getSizeZ() )
   {
      TPZString err;
      err.sprintf(ERR_TPZTONET_001, getSizeX(), getSizeY(), getSizeZ() );
      EXIT_PROGRAM(err);
   }

   /* Create the routers for each node */
   int i;     
   for( i=0; i<getSizeX(); i++ )
   {
      TPZPosition pos(i,0,0);
      TPZRouter* newRouter = (TPZRouter*)
                             (TPZRouter::routerBuilder->createComponentWithId(getRouterId(),this));
      if( ! newRouter )
      {
          TPZString err;
          err.sprintf( ERR_TPZTONET_002, (char*)getRouterId() );
          EXIT_PROGRAM(err);
      }
      newRouter->setPosition(pos);                       
      addRouter(newRouter);
   }

   /* Connect the routers together */
   for( i=0; i<getSizeX(); i++ )
   {
      initializeConnectionsFor(TPZPosition(i,0,0));
   }
  
   /* Other initialization tasks */
   generateRoutingTable();

   setInitializated(true);
   setSimulation(getSimulation());
}
Пример #25
0
bool SingleParticle2dx::DataStructures::Particle::checkParticle()
{
	real_array_type rdata( boost::extents[getSizeX()][getSizeY()] );
	getRealSpaceData(&rdata);
	
	if (SingleParticle2dx::Utilities::DataContainerFunctions::checkData(&rdata))
	{
		return false;
	}

	if (SingleParticle2dx::Utilities::DataContainerFunctions::calculateSD(&rdata) < 1e-5)
	{
		return false;
	}
	return true;
}
Пример #26
0
void TPZNetworkSquareMidimew :: generateRoutingTable()
{
   cerr << "Generating Routing Table...\n";
   int n = getSizeX();
   m_routingTable = new int[2*(n-1)];
   int sy = (int)(sqrt((float)n));
   int sx = sy/2 - 1;
   for(int m=1; m<n; m++)
   {
      int min=n;
      for(int x=-3*sy/4; x < 3*sy/4; x++ )
      {
         for(int y=-3*sy/4; y < 3*sy/4; y++)
         {
            if(m == ((x*sx + y*sy + n) % n) && abs(x)+abs(y) <= min)
             {
               min = abs(x)+abs(y);
               m_routingTable[2*(m-1)] = x; m_routingTable[2*(m-1)+1] = y;
             }
         }
      }
   }
}
Пример #27
0
void SingleParticle2dx::DataStructures::Particle::updateParticleShift()
{
	SingleParticle2dx::DataStructures::ParticleShift s = getParticleShift();
	real_array_type rdata( boost::extents[getSizeX()][getSizeY()] );
	real_array_type rdata2set( boost::extents[getSizeX()][getSizeY()] );
	getRealSpaceData(&rdata);
	
	size_type ii;
	size_type jj;
	
	for(size_type i=0; i<getSizeX(); i++)
	{
		for(size_type j=0; j<getSizeY(); j++)
		{
			ii = i + s.getShiftX();
			jj = j + s.getShiftY();
			
			if (ii<0)
			{
				ii += getSizeX();
			}
			
			if (jj<0)
			{
				jj += getSizeY();
			}
			
			if (ii >= getSizeX())
			{
				ii -= getSizeX();
			}
			
			if (jj >= getSizeY())
			{
				jj -= getSizeY();
			}
			
			rdata2set[i][j] = rdata[ii][jj];
		}
	}
	setFourierSpaceData(&rdata2set);
	m_optimal_shift.reset();
}
Пример #28
0
// drawTitle
//---------------------------------------------------------------------------
// Purpose: Draws the title of the view and colors the move area background
//          depending on whether the view is active.
//---------------------------------------------------------------------------
void View::drawTitle(Surface &viewArea)
{
    assert(this != 0);

    iRect r(borderSize, borderSize, getSizeX() - borderSize, borderSize + moveAreaHeight - 1);

    Surface s;
    s.setTo(viewArea, r);

    s.fill(getActive() ? activeWindowTitleBodyColor : inactiveWindowTitleBodyColor);

    char strBuf[256];

    sprintf(strBuf, "%s%s", title, subTitle);

    s.bltStringCenter(strBuf, getActive() ? activeWindowTitleTextColor : inactiveWindowTitleTextColor);

    if (getResize()) {
        {
            // Bottom-Left resize.
            iXY verticalPos(borderSize, getSizeY() - borderSize - moveAreaHeight + 1);
            iXY horizontalPos(borderSize + moveAreaHeight - 1, getSizeY() - borderSize);

            viewArea.drawLine(verticalPos, horizontalPos, Color::white);
            verticalPos.y++;
            horizontalPos.x--;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray224);
            verticalPos.y++;
            horizontalPos.x--;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray192);
            verticalPos.y++;
            horizontalPos.x--;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y++;
            horizontalPos.x--;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y++;
            horizontalPos.x--;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y++;
            horizontalPos.x--;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y++;
            horizontalPos.x--;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y++;
            horizontalPos.x--;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y++;
            horizontalPos.x--;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y++;
            horizontalPos.x--;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y++;
            horizontalPos.x--;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y++;
            horizontalPos.x--;
        }

        // Top-Left resize.
        {
            iXY verticalPos(borderSize, borderSize + moveAreaHeight - 1);
            iXY horizontalPos(borderSize + moveAreaHeight - 1, borderSize);

            viewArea.drawLine(verticalPos, horizontalPos, Color::white);
            verticalPos.y--;
            horizontalPos.x--;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray224);
            verticalPos.y--;
            horizontalPos.x--;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray192);
            verticalPos.y--;
            horizontalPos.x--;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y--;
            horizontalPos.x--;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y--;
            horizontalPos.x--;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y--;
            horizontalPos.x--;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y--;
            horizontalPos.x--;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y--;
            horizontalPos.x--;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y--;
            horizontalPos.x--;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y--;
            horizontalPos.x--;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y--;
            horizontalPos.x--;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y--;
            horizontalPos.x--;
        }

        // Top-Right resize.
        {
            iXY verticalPos(getSizeX() - borderSize, borderSize + moveAreaHeight - 1);
            iXY horizontalPos(getSizeX() - borderSize - moveAreaHeight, borderSize - 1);

            viewArea.drawLine(verticalPos, horizontalPos, Color::white);
            verticalPos.y--;
            horizontalPos.x++;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray224);
            verticalPos.y--;
            horizontalPos.x++;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray192);
            verticalPos.y--;
            horizontalPos.x++;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y--;
            horizontalPos.x++;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y--;
            horizontalPos.x++;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y--;
            horizontalPos.x++;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y--;
            horizontalPos.x++;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y--;
            horizontalPos.x++;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y--;
            horizontalPos.x++;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y--;
            horizontalPos.x++;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y--;
            horizontalPos.x++;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y--;
            horizontalPos.x++;
        }

        // Bottom-Right resize.
        {
            iXY verticalPos(getSizeX() - borderSize, getSizeY() - borderSize - moveAreaHeight + 1);
            iXY horizontalPos(getSizeX() - borderSize - moveAreaHeight + 1, getSizeY() - borderSize);

            viewArea.drawLine(verticalPos, horizontalPos, Color::white);
            verticalPos.y++;
            horizontalPos.x++;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray224);
            verticalPos.y++;
            horizontalPos.x++;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray192);
            verticalPos.y++;
            horizontalPos.x++;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y++;
            horizontalPos.x++;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y++;
            horizontalPos.x++;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y++;
            horizontalPos.x++;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y++;
            horizontalPos.x++;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y++;
            horizontalPos.x++;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y++;
            horizontalPos.x++;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y++;
            horizontalPos.x++;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y++;
            horizontalPos.x++;
            viewArea.drawLine(verticalPos, horizontalPos, Color::gray160);
            verticalPos.y++;
            horizontalPos.x++;
        }
    }

} // end View::drawTitle
Пример #29
0
	int GridEnv::toNodeID(const NodeCoord& nodeCoord) const
	{
		FDK_ASSERT(isValidNodeCoord(nodeCoord));
		return nodeCoord.y * getSizeX() + nodeCoord.x;
	}
Пример #30
0
//*************************************************************************
//:
//  f: getDiameter unsigned long () const;
//
//  d:
//:
//*************************************************************************
unsigned TPZNetworkSquareMidimew::getDiameter() const
{
   /* Calculate the diameter of the network */
   return (unsigned)(3*sqrt((float)getSizeX())/4);
}