示例#1
0
	void RegionTextureControl::updateUnselectedStates()
	{
		std::vector<MyGUI::IntCoord> coords;

		if (getCurrentSkin() != nullptr)
		{
			ItemHolder<RegionItem>::EnumeratorItem regions = getCurrentSkin()->getRegions().getChildsEnumerator();
			while (regions.next())
			{
				RegionItem* item = regions.current();
				if (item != getCurrentSkin()->getRegions().getItemSelected())
				{
					if (item->getPropertySet()->getPropertyValue("Visible") == "True")
					{
						if (item->getPropertySet()->getPropertyValue("Enabled") == "True")
						{
							addCoord(coords, item->getPropertySet()->getPropertyValue("Position"));
						}
					}
				}
			}
		}

		drawUnselectedStates(coords);
	}
示例#2
0
//add delta to all elements of vector, add delta as element of vector, return 1 if vector has at least 1 horizontal movement else return 0
int verify(vector_t* trajectories,event_t* evt, short length, unsigned short tolerance)
{
	if((evt->delta.x == 0) && (evt->delta.y == 0))//no movement
		return 0;
	size_t i  = 0;
	for(; i < size(trajectories); i++)
	{
		if( ((coord_t *) at(trajectories, i))->x * evt->delta.x < 0) //if direction in x axis is reversed...
			{
				erase(trajectories, i);// ...cancel current trajectory
				i--;
			}
		else
		{
			(* (coord_t *) at(trajectories, i)) = addCoord(*(coord_t *)(at(trajectories, i)), evt->delta);//add last movement to each trajectory
			if(abs( ((coord_t *)at(trajectories, i))->y) > tolerance) //if movement in y axis exceeds tolerance...
			{
				erase(trajectories, i); //...cancel trajectory
				i--;
			}
			else
			{
				if( length > 0)
				{if(  ((coord_t *)(at(trajectories, i)))->x > length)
					return 1;} // if at least one trajectory exceeds length, the movement is horizontal
				else if(length < 0)
				{if(  ((coord_t *)(at(trajectories, i)))->x < length)
					return 1;}// if at least one trajectory exceeds length, the movement is horizontal
			}
		}
	}
	push_back(trajectories, &(evt->delta)); // each movement is a new trajectory
	return 0;
}
	void SeparatorTextureControl::updateUnselectedStates()
	{
		std::vector<int> coordsHor;
		std::vector<int> coordsVert;

		if (getCurrentSkin() != nullptr)
		{
			ItemHolder<SeparatorItem>::EnumeratorItem separators = getCurrentSkin()->getSeparators().getChildsEnumerator();
			while (separators.next())
			{
				SeparatorItem* item = separators.current();
				if (item != getCurrentSkin()->getSeparators().getItemSelected())
				{
					if (item->getPropertySet()->getPropertyValue("Visible") == "True")
					{
						MyGUI::Align corner = item->getCorner();

						addCoord(coordsHor, coordsVert, corner,
							item->getPropertySet()->getPropertyValue("Offset"));
					}
				}
			}
		}

		drawUnselectedStates(coordsHor, coordsVert);
	}
示例#4
0
void
pamd_fill_drawproc(tuple **     const tuples, 
                   unsigned int const cols, 
                   unsigned int const rows, 
                   unsigned int const depth, 
                   sample       const maxval, 
                   pamd_point   const p,
                   const void * const clientdata) {

    const fillobj *    const fillObjP = clientdata;
    struct fillState * const stateP   = fillObjP->stateP;

    /* Make room for two more coords, the max we might add. */
    if (stateP->n + 2 > stateP->size) {
        stateP->size += SOME;
        REALLOCARRAY(stateP->coords, stateP->size);
        if (stateP->coords == NULL)
            pm_error("out of memory enlarging a fillhandle");
    }

    if (stateP->n == 0) {
        /* Start first segment. */
        stateP->segstart = stateP->n;
        stateP->ydir = 0;
        stateP->startydir = 0;
        addCoord(stateP, p);
    } else {
        pamd_point const prevPoint = stateP->coords[stateP->n - 1].point;
        int const dx = p.x - prevPoint.x;
        int const dy = p.y - prevPoint.y;

        if (dx == 0 && dy == 0) {
            /* These are the same coords we had last time; don't bother */
        } else {
            if (abs(dx) > 1 || abs(dy) > 1)
                startNewSegment(stateP);
            else
                continueSegment(stateP, dy);

            addCoord(stateP, p);
        }
    }
}
示例#5
0
// Write a column permutation explicitly
void ColPerm::makeExplicit(Permut& out) const
{
  long sz = getSize();
  out.SetLength(sz);

  for (long k = 0; k < sz; k++) {
    long i = getCoord(k, dim);
    long pi_i = at(k);
    out.at(k) = addCoord(k, dim, pi_i-i);
  }
}
示例#6
0
   void sdbDataSource::_syncCoordNodes()
   {
      INT32 rc ;
      string tmp ;
      sdb conn ;
      rc = _strategy->getNextCoord( tmp ) ;
      if (SDB_OK != rc)
         return ;
      INT32 pos = tmp.find_first_of( ":" ) ;
      rc = conn.connect( 
         tmp.substr(0, pos).c_str(), 
         tmp.substr(pos+1, tmp.length()).c_str(), 
         _conf.getUserName().c_str(),
         _conf.getPasswd().c_str() ) ;
      if ( SDB_OK != rc )
      {
         conn.disconnect() ;
         return ;
      }
      else
      {
         sdbReplicaGroup group ;
         rc = conn.getReplicaGroup( "SYSCoord", group ) ;
         if ( SDB_OK != rc )
         {
            conn.disconnect() ;
            return ;
         }
         bson::BSONObj obj ;
         group.getDetail( obj ) ;

         bson::BSONElement eleGroup = obj.getField( "Group" ) ;
         bson::BSONObjIterator itr( eleGroup.embeddedObject() ) ;
         while( itr.more() )
         {
            string newcoord ;
            bson::BSONObj hostItem  ;
            bson::BSONElement hostElement = itr.next()  ;
            hostItem = hostElement.embeddedObject()  ;
            const CHAR* pname = hostItem.getField( "HostName" ).valuestr() ;
            newcoord.append(pname).append( ":" ) ;
            bson::BSONElement serviceEle  = hostItem.getField( "Service" ) ;
            bson::BSONObjIterator itrPort( serviceEle.embeddedObject() )  ;
            if ( itrPort.more() )
            {
               bson::BSONObj portItem  ;
               bson::BSONElement portEle = itrPort.next() ;
               portItem = portEle.embeddedObject() ;
               newcoord.append(portItem.getField( "Name" ).valuestr()) ;
               addCoord(newcoord) ;
            }
         }
      }
   }
示例#7
0
void HyperCube<T>::shift1D(long d, long k)
{
  assert(d >=0 && d < getNumDims());

  // Make sure rotation amount is in the range [1,dimSize-1]
  bool negative = (k<0);
  k %= getDim(d);
  if (k == 0) return;
  if (k < 0) k += getDim(d);

  if (negative) { // left shift, zeros at the end
    for (long i=getSize()-1; i>=0; i--) {
      long iPrime = addCoord(i, d, k);
      if (iPrime < i) data[iPrime] = data[i];
      else            data[iPrime] = T(); // empty
    }
  } else {        // right shift, zeros at the beginning
    for (long i=0; i<getSize(); i++) {
      long iPrime = addCoord(i, d, k);
      if (iPrime > i) data[iPrime] = data[i];
      else            data[iPrime] = T(); // empty
    }
  }
}
示例#8
0
// For each position in the data vector, compute how many slots it should be
// shifted inside its small permutation.
// Return value is zero if all the shift amounts are zero, nonzero otherwise.
long ColPerm::getShiftAmounts(Vec<long>& out) const
{
  long sz = getSize();
  out.SetLength(sz);
  long nonZero = 0;

  for (long k = 0; k < sz; k++) {
    long i = getCoord(k, dim);
    long pi_i = at(k);
    if (i != pi_i) nonZero = 1;
    out.at(addCoord(k, dim, pi_i-i)) = i - pi_i;
  }

  return nonZero;
 
}
示例#9
0
void HyperCube<T>::rotate1D(long d, long k)
{
  assert(d >=0 && d < getNumDims());

  // Make sure rotation amount is in the range [1,dimSize-1]
  k %= getDim(d);
  if (k == 0) return;
  if (k < 0) k += getDim(d);

  // A simple implementation with a temporary vector
  Vec<T> tmp(INIT_SIZE, getSize());
  for (long i=0; i<getSize(); i++) 
    tmp[addCoord(i, d, k)] = data[i];
  for (long i=0; i<getSize(); i++)
    data[i] = tmp[i];
}
示例#10
0
static void
continueSegment(struct fillState * const stateP,
                int                const dy) {
/*----------------------------------------------------------------------------
   'dy' is how much the current point is above the previous one.
-----------------------------------------------------------------------------*/
    if (dy != 0) {
        if (stateP->ydir != 0 && stateP->ydir != dy) {
            /* Direction changed.  Insert a fake coord, old
               position but new edge number.
            */
            ++stateP->curedge;
            addCoord(stateP, stateP->coords[stateP->n - 1].point);
        }
        stateP->ydir = dy;
        if (stateP->startydir == 0)
            stateP->startydir = dy;
    }
}
示例#11
0
	void StateTextureControl::updateUnselectedStates()
	{
		std::vector<MyGUI::IntCoord> coords;

		if (getCurrentSkin() != nullptr)
		{
			ItemHolder<StateItem>::EnumeratorItem states = getCurrentSkin()->getStates().getChildsEnumerator();
			while (states.next())
			{
				StateItem* item = states.current();
				if (item != getCurrentSkin()->getStates().getItemSelected())
				{
					if (item->getPropertySet()->getPropertyValue("Visible") == "True")
						addCoord(coords,
							getCurrentSkin()->getPropertySet()->getPropertyValue("Coord"),
							item->getPropertySet()->getPropertyValue("Position"));
				}
			}
		}

		drawUnselectedStates(coords);
	}