void endElement( const XMLCh * const uri,const XMLCh * const localName,const XMLCh * const qname )
  {
    if (current_interesting)
      {
	if (XMLString::equals(localName,OSM::szWAY))
	  {
	    cout << "type:" << getCurrentType() << " current_id :" <<  current_id << " name: " << current_name;
	    if (ndcount)
	      {
		cout << " ndcount:" << ndcount;
		cout << " box :" << box;
		int ok = world.tree.Insert( bounds( box  ), current_id);
		if (!ok)
		  {
		    cerr << "Insert failed!" <<endl;
		  }
		ndcount=0;
		box.reset();
		current_interesting=0;
	      }
	    cout << endl;	    	    
	  }
	else
	  {
	    if (report_other_ways)
	      {
		cout << "ERRORnot interesting type:WAY" << " current_id :" <<  current_id << " name: " << current_name;
		cout << endl;
	      }
	  }	
      }
  }
Exemple #2
0
// --------------------------------------------------------------------------------
// -------------------- UpdateMove
// --------------------------------------------------------------------------------
UpdateMove::UpdateMove(const Position& posFromBegin, const Position& posFromEnd, const Position& posTo, IDocument::Type fileTo, IDocument::Type fileFrom)
    : DocUpdate     (fileTo      )
    , m_posFromBegin(posFromBegin)
    , m_posFromEnd  (posFromEnd  )
    , m_posTo       (posTo       )
    , m_fileFrom    (fileFrom    )
{
    if (static_cast<int>(m_fileFrom) == static_cast<int>(rdo::converter::smr2rdox::FileTypeOut::UNDEFINED))
        m_fileFrom = getCurrentType();
}
Exemple #3
0
OPEN_RDO_CONVERTER_SMR2RDOX_NAMESPACE

// --------------------------------------------------------------------------------
// -------------------- DocUpdate
// --------------------------------------------------------------------------------
DocUpdate::DocUpdate(IDocument::Type file)
    : m_file(file)
{
    if (m_file == IDocument::Type::UNDEFINED)
        m_file = getCurrentType();
}
Exemple #4
0
void OSPRayMaterial::commit()
{
    // Do nothing until this material is instanced for a specific renderer
    if (!_ospMaterial || !isModified())
        return;

    if (getCurrentType() == "simulation")
        osphelper::set(_ospMaterial, "apply_simulation", 1);
    else
        ospRemoveParam(_ospMaterial, "apply_simulation");

    osphelper::set(_ospMaterial, "kd", Vector3f(_diffuseColor));
    osphelper::set(_ospMaterial, "ks", Vector3f(_specularColor));
    osphelper::set(_ospMaterial, "ns", static_cast<float>(_specularExponent));
    osphelper::set(_ospMaterial, "d", static_cast<float>(_opacity));
    osphelper::set(_ospMaterial, "refraction",
                   static_cast<float>(_refractionIndex));
    osphelper::set(_ospMaterial, "reflection",
                   static_cast<float>(_reflectionIndex));
    osphelper::set(_ospMaterial, "a", static_cast<float>(_emission));
    osphelper::set(_ospMaterial, "glossiness", static_cast<float>(_glossiness));
    osphelper::set(_ospMaterial, "skybox", _isBackGroundMaterial);

    // Properties
    toOSPRayProperties(*this, _ospMaterial);

    // Textures
    for (const auto& textureType : textureTypeMaterialAttribute)
        ospSetObject(_ospMaterial, textureType.attribute.c_str(), nullptr);

    for (const auto& textureDescriptor : _textureDescriptors)
    {
        const auto texType = textureDescriptor.first;
        auto texture = getTexture(texType);
        if (texture)
        {
            auto ospTexture = _createOSPTexture2D(texture);
            const auto str =
                textureTypeMaterialAttribute[texType].attribute.c_str();
            ospSetObject(_ospMaterial, str, ospTexture);
            ospRelease(ospTexture);
        }
    }

    ospCommit(_ospMaterial);
    resetModified();
}
Exemple #5
0
bool View::handleEvent( const Event& event )
{
    switch( event.type )
    {
    case Event::VIEW_RESIZE:
    {
        const ResizeEvent& resize = event.resize;
        if( resize.dw == 0.f || resize.dh == 0.f )
            return true;

        switch( getCurrentType( ))
        {
        case TYPE_WALL:
        {
            const float ratio( resize.dw / resize.dh );
            Wall wall( impl_->baseFrustum.getWall( ));
            wall.resizeHorizontal( ratio );

            lunchbox::ScopedFastWrite mutex( impl_->eventLock );
            setWall( wall );
            break;
        }

        case View::TYPE_PROJECTION:
        {
            const float ratio( resize.dw / resize.dh );
            eq::Projection projection( impl_->baseFrustum.getProjection( ));
            projection.resizeHorizontal( ratio );

            lunchbox::ScopedFastWrite mutex( impl_->eventLock );
            setProjection( projection );
            break;
        }

        case eq::View::TYPE_NONE:
            break;
        default:
            LBUNIMPLEMENTED;
            break;
        }
        return true;
    }
    }

    return false;
}
Exemple #6
0
void Frustum::serialize( co::DataOStream& os )
{
    switch( getCurrentType( ))
    {
        case TYPE_WALL:
            os << TYPE_WALL << _data.wall;
            break;

        case TYPE_PROJECTION:
            os << TYPE_PROJECTION << _data.projection;
            break;

        case TYPE_NONE:
            os << TYPE_NONE;
            break;

        default:
            LBASSERT( false );
    }
}
Exemple #7
0
bool View::handleEvent(const EventType type, const SizeEvent& event)
{
    if (type != EVENT_VIEW_RESIZE)
        return false;

    if (event.dw == 0.f || event.dh == 0.f)
        return true;

    switch (getCurrentType())
    {
    case TYPE_WALL:
    {
        const float ratio(event.dw / event.dh);
        Wall wall(_impl->baseFrustum.getWall());
        wall.resizeHorizontal(ratio);

        lunchbox::ScopedFastWrite mutex(_impl->eventLock);
        setWall(wall);
        return true;
    }

    case View::TYPE_PROJECTION:
    {
        const float ratio(event.dw / event.dh);
        eq::Projection projection(_impl->baseFrustum.getProjection());
        projection.resizeHorizontal(ratio);

        lunchbox::ScopedFastWrite mutex(_impl->eventLock);
        setProjection(projection);
        return true;
    }

    default:
        LBUNIMPLEMENTED;
    case eq::View::TYPE_NONE:
        return false;
    }
}
Exemple #8
0
float View::_computeFocusRatio( Vector3f& eye )
{
    eye = Vector3f::ZERO;
    const Observer* observer = getObserver();
    const FocusMode mode = observer ? observer->getFocusMode() :FOCUSMODE_FIXED;
    if( mode == FOCUSMODE_FIXED )
        return 1.f;

    const Channels& channels = getChannels();
    if( channels.empty( ))
        return 1.f;

    Vector4f view4( Vector3f::FORWARD );
    if( mode == FOCUSMODE_RELATIVE_TO_OBSERVER )
    {
        view4 = observer->getHeadMatrix() * view4;
        eye = observer->getEyePosition( EYE_CYCLOP );
    }
    Vector3f view = view4;
    view.normalize();

    float distance = std::numeric_limits< float >::max();
    if( getCurrentType() != Frustum::TYPE_NONE ) // frustum from view
    {
        const Wall& wall = getWall();
        const Vector3f w = wall.getW();
        const float denom = view.dot( w );
        if( denom != 0.f ) // view parallel to wall
        {
            const float d = (wall.bottomLeft - eye).dot( w ) / denom;
            if( d > 0.f )
                distance = d;
        }
    }
    else
    {
        // Find closest segment and its distance from cyclop eye
        for( ChannelsCIter i = channels.begin(); i != channels.end(); ++i )
        {
            Segment* segment = (*i)->getSegment();
            if( segment->getCurrentType() == Frustum::TYPE_NONE )
            {
                segment->notifyFrustumChanged();
                if( segment->getCurrentType() == Frustum::TYPE_NONE )
                    continue;
            }

            // http://en.wikipedia.org/wiki/Line-plane_intersection
            const Wall& wall = segment->getWall();
            const Vector3f w = wall.getW();
            const float denom = view.dot( w );
            if( denom == 0.f ) // view parallel to wall
                continue;

            const float d = (wall.bottomLeft - eye).dot( w ) / denom;
            if( d > distance || d <= 0.f ) // further away or behind
                continue;

            distance = d;
            //LBINFO << "Eye " << eye << " is " << d << " from " << wall
            // << std::endl;
        }
    }

    float focusDistance = observer->getFocusDistance();
    if( mode == FOCUSMODE_RELATIVE_TO_ORIGIN )
    {
        eye = observer->getEyePosition( EYE_CYCLOP );

        if( distance != std::numeric_limits< float >::max( ))
        {
            distance += eye.z();
            focusDistance += eye.z();
            if( fabsf( distance ) <= std::numeric_limits< float >::epsilon( ))
                distance = 2.f * std::numeric_limits< float >::epsilon();
        }
    }

    if( distance == std::numeric_limits< float >::max( ))
        return 1.f;
    return focusDistance / distance;
}
void channels::zapCurrentChannel()
{
	//zap_obj->zap_allstop();

	linkage_perspectives.clear();

	current_mode = CHANNEL;

	zap_obj->stop();

	if (tune(getCurrentTS(), getCurrentONID()))
	{

		fprintf(stderr, "Getting pat\n");
		pat_obj->readPAT();
		fprintf(stderr, "Got it\n");
	
		ECM = 0;
	
		apid = 0;
	
		int tmp_pmt = pat_obj->getPMT(getCurrentSID());
	
		if (tmp_pmt != 0)
		{
			setCurrentPMT(pat_obj->getPMT(getCurrentSID()));
			
			fprintf(stderr, "Getting pmt\n");
			pmt_data pmt_entry = (pmt_obj->readPMT(getCurrentPMT()));
			fprintf(stderr, "Got it\n");
			
			setCurrentPMTdata(pmt_entry);
			deleteCurrentAPIDs();
			number_components = 0;
			video_component = 0;
			for (int i = 0; i < pmt_entry.pid_counter; i++)
			{
				if (pmt_entry.type[i] == 0x02)
				{
					setCurrentVPID(pmt_entry.PID[i]);
					video_component = pmt_entry.component[i];
				}
				else if (pmt_entry.type[i] == 0x04 || pmt_entry.type[i] == 0x03)
				{
					addCurrentAPID(pmt_entry.PID[i]);
					component[number_components++] = pmt_entry.component[i];
				}
				else if (pmt_entry.type[i] == 0x06 && pmt_entry.subtype[i] == 1)
				{
					setCurrentTXT(pmt_entry.PID[i]);
				}
				else if (pmt_entry.type[i] == 0x06 && pmt_entry.subtype[i] != 1)
				{
					addCurrentAPID(pmt_entry.PID[i], (bool) true);
					component[number_components++] = pmt_entry.component[i];
				}
			
				//printf("type: %d - PID: %04x\n", pmt_entry.type[i], pmt_entry.PID[i]);
			}
		
				for (int i = 0; i < pmt_entry.ecm_counter; i++)
			{
				if (setting->getCAID() == pmt_entry.CAID[i])
					ECM = pmt_entry.ECM[i];
				//printf("CAID: %04x - ECM: %04x\n", pmt_entry.CAID[i], pmt_entry.ECM[i]);
			}
			basic_channellist[cur_pos].PCR = pmt_entry.PCR;
		
			hardware_obj->useDD(getCurrentDD(0));
			if (getCurrentAPIDcount() == 1)
				(*zap_obj).zap_to(pmt_entry, getCurrentVPID(), getCurrentAPID(0), getCurrentPCR(), ECM, getCurrentSID(), getCurrentONID(), getCurrentTS());
			else
				(*zap_obj).zap_to(pmt_entry, getCurrentVPID(), getCurrentAPID(0), getCurrentPCR(), ECM, getCurrentSID(), getCurrentONID(), getCurrentTS(), getCurrentAPID(1));
			
			
			if (getCurrentAPIDcount() > 1)
				(*eit_obj).setAudioComponent(component[apid]);
			else
				(*eit_obj).setAudioComponent(-1);
			}
	
		if (getCurrentType() == 4)
		{
			vars->setvalue("%IS_NVOD", "true");
			osd_obj->setNVODAvailable(true);
		}
		else 
		{
			vars->setvalue("%IS_NVOD", "false");
			osd_obj->setNVODAvailable(false);
		}

		last_channels.push(cur_pos);
		int number_last_chans = 2;
		if (vars->isavailable("%NUMBERLASTCHANNELS"))
		{
			number_last_chans = atoi(vars->getvalue("%NUMBERLASTCHANNELS").c_str());
		}
		if (last_channels.size() > (unsigned int) number_last_chans)
		{
			last_channels.pop();
		}
	}
}