* This routine extracts the parameters of the specified * proto from the class description and adds a rendering of * the proto onto the ShapeList. * * @param window ScrollView instance * @param Class class that proto is contained in * @param ProtoId id of proto to be rendered * @param color color to render proto in * * Globals: none * * @return New shape list with a rendering of one pro
| 1789 | * @note History: Thu Mar 21 10:21:09 1991, DSJ, Created. |
| 1790 | */ |
| 1791 | void RenderIntProto(ScrollView *window, |
| 1792 | INT_CLASS Class, |
| 1793 | PROTO_ID ProtoId, |
| 1794 | ScrollView::Color color) { |
| 1795 | PROTO_SET ProtoSet; |
| 1796 | INT_PROTO Proto; |
| 1797 | int ProtoSetIndex; |
| 1798 | int ProtoWordIndex; |
| 1799 | FLOAT32 Length; |
| 1800 | int Xmin, Xmax, Ymin, Ymax; |
| 1801 | FLOAT32 X, Y, Dx, Dy; |
| 1802 | uinT32 ProtoMask; |
| 1803 | int Bucket; |
| 1804 | |
| 1805 | assert(ProtoId >= 0); |
| 1806 | assert(Class != NULL); |
| 1807 | assert(ProtoId < Class->NumProtos); |
| 1808 | assert(color != 0); |
| 1809 | window->Pen(color); |
| 1810 | |
| 1811 | ProtoSet = Class->ProtoSets[SetForProto(ProtoId)]; |
| 1812 | ProtoSetIndex = IndexForProto(ProtoId); |
| 1813 | Proto = &(ProtoSet->Protos[ProtoSetIndex]); |
| 1814 | Length = (Class->ProtoLengths[ProtoId] * |
| 1815 | GetPicoFeatureLength() * INT_CHAR_NORM_RANGE); |
| 1816 | ProtoMask = PPrunerMaskFor(ProtoId); |
| 1817 | ProtoWordIndex = PPrunerWordIndexFor(ProtoId); |
| 1818 | |
| 1819 | // find the x and y extent of the proto from the proto pruning table |
| 1820 | Xmin = Ymin = NUM_PP_BUCKETS; |
| 1821 | Xmax = Ymax = 0; |
| 1822 | for (Bucket = 0; Bucket < NUM_PP_BUCKETS; Bucket++) { |
| 1823 | if (ProtoMask & ProtoSet->ProtoPruner[PRUNER_X][Bucket][ProtoWordIndex]) { |
| 1824 | UpdateRange(Bucket, &Xmin, &Xmax); |
| 1825 | } |
| 1826 | |
| 1827 | if (ProtoMask & ProtoSet->ProtoPruner[PRUNER_Y][Bucket][ProtoWordIndex]) { |
| 1828 | UpdateRange(Bucket, &Ymin, &Ymax); |
| 1829 | } |
| 1830 | } |
| 1831 | X = (Xmin + Xmax + 1) / 2.0 * PROTO_PRUNER_SCALE; |
| 1832 | Y = (Ymin + Ymax + 1) / 2.0 * PROTO_PRUNER_SCALE; |
| 1833 | // The -PI has no significant effect here, but the value of Theta is computed |
| 1834 | // using BinaryAnglePlusPi in intfx.cpp. |
| 1835 | Dx = (Length / 2.0) * cos((Proto->Angle / 256.0) * 2.0 * PI - PI); |
| 1836 | Dy = (Length / 2.0) * sin((Proto->Angle / 256.0) * 2.0 * PI - PI); |
| 1837 | |
| 1838 | window->SetCursor(X - Dx, Y - Dy); |
| 1839 | window->DrawTo(X + Dx, Y + Dy); |
| 1840 | } /* RenderIntProto */ |
| 1841 | #endif |
| 1842 | |
| 1843 | /** |
no test coverage detected