The method for searching a table is
1. Read the scalar or to the most, and store it with a vtkfloatarray. The scalar in it can represent different colors.
2. Create a search table, use setnuberofcolors () to allocate space, assign values, and use build () to create a search table.
3. Combine the scalar array with the vtkfloatarray and the polygon, and combine the lookup table with the vtkmapper.
Note: The float type is used for table search.
DetailsCodeAs follows:
M_abstractreader-> setfile (); // connects to the media transcoding queue.
Mypoints-> insertnextpoint (0.0, 0.0, 0.0 );
For (int kk = 0; KK <m_javasactreader-> numnode; KK ++)
{
Mypoints-> insertnextpoint (m_javasactreader-> node [Kk] [0], m_javasactreader-> node [Kk] [1], m_javasactreader-> node [Kk] [2]);
}
Mygrid-> setpoints (mypoints );
Mygrid-> allocate (2000,100 0 );///////////
For (int kkk = 0; KKK <m_javasactreader-> numele; KKK ++)
{
Mygrid-> insertnextcell (12, 8, m_javasactreader-> ele [KKK]);
}
//// // Sets the Vector
Myarray-> setnumberoftuples (m_abstractreader-> numele );
For (INT Mmm = 0; Mmm <m_abstractreader-> numele; Mmm ++)
{
Myarray-> inserttuple (MMM, & m_abstractreader-> VEC [Mmm]);
}
Mygrid-> getcelldata ()-> setscalars (myarray );
Mytable-> setnumberofcolors (9 );
Mytable-> settablerange (0, 8 );
Mytable-> settablevalue (0, 1.0, 0.0, 0.0 );
Mytable-> settablevalue (1, 0.0, 1.0, 0.0 );
Mytable-> settablevalue (2, 0.0, 0.0, 1.0 );
Mytable-> settablevalue (3, 1.0, 1.0, 0.0 );
Mytable-> settablevalue (4, 0.0, 1.0, 1.0 );
Mytable-> settablevalue (5, 1.0, 0.0, 1.0 );
Mytable-> settablevalue (6, 0.5, 2.0, 0.8 );
Mytable-> settablevalue (7, 1.0, 0.0, 0.0 );
Mytable-> settablevalue (8, 1.0, 0.4, 0.5 );
Mytable-> build ();
Filter-> setinput (mygrid );
//// // Entity painting
Normals-> setinputconnection (filter-> getoutputport ());
Normals-> flipnormalson ();
Normals-> setflipnormals (1 );
Conemapper-> setinputconnection (Normals-> getoutputport ());
/// // Use the lookup table
Conemapper-> setscalarmodetousecelldata ();
Conemapper-> uselookuptablescalarrangeon ();
Conemapper-> setlookuptable (mytable );
//////////////////////////////////////// ////////////////////
//////////// Wiredrawing /////////////////////// ////////////
Normalswire-> setinputconnection (filter-> getoutputport ());
Normalswire-> flipnormalson ();
Normalswire-> setflipnormals (1 );
Actormapper-> setinputconnection (normalswire-> getoutputport ());
Actormapper-> setresolvecoincidenttopologytopolygonoffset ();