private void SampleNode( Node node, ref int color, ref int border, ref ushort[] id, ref ushort[] riverid, ref int samples ) { if ( node.IsBranch() ) { color += ((int)node.BottomRightChild.Data.Color << 16) + ((int)node.BottomLeftChild.Data.Color << 16) + ((int)node.TopRightChild.Data.Color << 16) + ((int)node.TopLeftChild.Data.Color << 16); border += ((int)node.BottomRightChild.Data.Border << 16) + ((int)node.BottomLeftChild.Data.Border << 16) + ((int)node.TopRightChild.Data.Border << 16) + ((int)node.TopLeftChild.Data.Border << 16); ++id[node.BottomRightChild.Data.ID]; ++id[node.BottomLeftChild.Data.ID]; ++id[node.TopRightChild.Data.ID]; ++id[node.TopLeftChild.Data.ID]; ++riverid[node.BottomRightChild.Data.RiverID]; ++riverid[node.BottomLeftChild.Data.RiverID]; ++riverid[node.TopRightChild.Data.RiverID]; ++riverid[node.TopLeftChild.Data.RiverID]; samples += 4; } else { color += node.Data.Color << 16; border += node.Data.Border << 16; id[node.Data.ID] += 4; riverid[node.Data.RiverID] += 4; samples++; } }
protected override void OnVisitNode( Node node, int x, int y ) { sb.AppendFormat( "[{0}|{1}|", node.Level, node.IsBranch() ? "B" : "L" ); if ( !(node.IsBranch() && node.Level > 1) ) { if ( node.IsBranch() ) { // 4 leaves on pixel level sb.Append( "4" ); HandleNode( node.BottomRightChild, x+1, y+1 ); HandleNode( node.BottomLeftChild, x, y+1 ); HandleNode( node.TopRightChild, x+1, y ); HandleNode( node.TopLeftChild, x, y ); } else { // Leaf above pixel level sb.Append( "1" ); HandleNode( node, x, y ); } } sb.Append( "] " ); }
protected override void OnVisitNode( Node node, int x, int y ) { tree[treeindex++] = node.IsBranch(); if ( node.IsBranch() && node.Level > 1 ) return; if ( node.IsBranch() ) { // 4 leaves on pixel level owners[leafindex] = ConvertID( node.BottomRightChild.Data.ID ); // Store the province colors[leafindex++] = node.BottomRightChild.Data.Color; owners[leafindex] = ConvertID( node.BottomLeftChild.Data.ID ); // Store the province colors[leafindex++] = node.BottomLeftChild.Data.Color; owners[leafindex] = ConvertID( node.TopRightChild.Data.ID ); // Store the province colors[leafindex++] = node.TopRightChild.Data.Color; owners[leafindex] = ConvertID( node.TopLeftChild.Data.ID ); // Store the province colors[leafindex++] = node.TopLeftChild.Data.Color; } else { // Leaf above pixel level owners[leafindex] = ConvertID( node.Data.ID ); colors[leafindex++] = node.Data.Color; } }